about summary refs log tree commit diff
path: root/users/fcuny/desktop
diff options
context:
space:
mode:
Diffstat (limited to 'users/fcuny/desktop')
-rw-r--r--users/fcuny/desktop/sway/sway-idle.nix23
1 files changed, 17 insertions, 6 deletions
diff --git a/users/fcuny/desktop/sway/sway-idle.nix b/users/fcuny/desktop/sway/sway-idle.nix
index 7db37bf..8583a3b 100644
--- a/users/fcuny/desktop/sway/sway-idle.nix
+++ b/users/fcuny/desktop/sway/sway-idle.nix
@@ -1,11 +1,22 @@
 { pkgs, config, ... }:
 
 {
-  services.swayidle = {
-    enable = true;
-    timeouts = [{
-      timeout = 300;
-      command = "${pkgs.swaylock}/bin/swaylock -fF -c 1D2021";
-    }];
+  # https://github.com/nix-community/home-manager/pull/2610
+  # won't be needed for ever
+  systemd.user.services.swayidle = {
+    Unit.PartOf = [ "sway-session.target" ];
+    Install.WantedBy = [ "sway-session.target" ];
+
+    Service = {
+      Environment = "PATH=${pkgs.bash}/bin:${config.wayland.windowManager.sway.package}/bin";
+      ExecStart = ''
+        ${pkgs.swayidle}/bin/swayidle -w \
+            timeout 300 "${pkgs.swaylock}/bin/swaylock -f -c FFFFEA" \
+            timeout 300 'swaymsg "output * dpms off"' \
+                resume 'swaymsg "output * dpms on"' \
+            before-sleep "${pkgs.swaylock}/bin/swaylock -f -c FFFFEA"
+      '';
+      Restart = "on-failure";
+    };
   };
 }