ctucx.git: nixfiles

ctucx' nixfiles

commit 1e55d6f1322afaf96e96db6f1bff67aa18a08805
parent 30014e2a36562dd16db612e9865926a14c04c455
Author: Leah (ctucx) <leah@ctu.cx>
Date: Thu, 20 Jan 2022 10:29:31 +0100

programs/pipewire: add sway-keybind to reconnect pipewire-pulse tunnel
1 file changed, 22 insertions(+), 16 deletions(-)
M
configurations/programs/pipewire.nix
|
38
++++++++++++++++++++++----------------
diff --git a/configurations/programs/pipewire.nix b/configurations/programs/pipewire.nix
@@ -74,25 +74,31 @@
     };
   };
 
-  home-manager.users.leah.systemd.user.services = lib.mkIf (config.networking.hostName == "stasicontainer") {
-    pipewire-pulse-tunnel = {
-      Unit = {
-        Requires = [ "pipewire-pulse.service" ];
-        After    = [ "pipewire-pulse.service" "network-online.target" ];
-        BindsTo  = [ "pipewire-pulse.service" ];
-      };
+  home-manager.users.leah = {
+    systemd.user.services = lib.mkIf (config.networking.hostName == "stasicontainer") {
+      pipewire-pulse-tunnel = {
+        Unit = {
+          Requires = [ "pipewire-pulse.service" ];
+          After    = [ "pipewire-pulse.service" "network-online.target" ];
+          BindsTo  = [ "pipewire-pulse.service" ];
+        };
 
-      Service = {
-        Type            = "oneshot";
-        RemainAfterExit = true;
-        ExecStartPre    = "/usr/bin/env sh -c 'until ping -c1 195.39.246.41; do sleep 0.1; done;'";
-        ExecStart       = "${pkgs.pulseaudio}/bin/pactl load-module module-tunnel-sink server=195.39.246.41";
-        ExecStop        = "${pkgs.pulseaudio}/bin/pactl unload-module module-tunnel-sink";
-      };
+        Service = {
+          Type            = "oneshot";
+          RemainAfterExit = true;
+          ExecStartPre    = "/usr/bin/env sh -c 'until ping -c1 195.39.246.41; do sleep 0.1; done;'";
+          ExecStart       = "${pkgs.pulseaudio}/bin/pactl load-module module-tunnel-sink server=195.39.246.41";
+          ExecStop        = "${pkgs.pulseaudio}/bin/pactl unload-module module-tunnel-sink";
+        };
 
-      Install = {
-        WantedBy = [ "pipewire-pulse.service" ];
+        Install = {
+          WantedBy = [ "pipewire-pulse.service" ];
+        };
       };
     };
+
+    wayland.windowManager.sway.config.keybindings = {
+      "${config.home-manager.users.leah.wayland.windowManager.sway.config.modifier}+Insert" = "exec systemctl --user restart pipewire-pulse-tunnel.service";
+    };
   };
 }