about summary refs log tree commit diff
path: root/users
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-02-13 13:06:07 -0800
committerFranck Cuny <franck@fcuny.net>2022-02-13 13:06:07 -0800
commitedb0fa477009492930f19d9aa20752a7dc6261e5 (patch)
tree04fb45d51ffcb9c57ffbcf242f32584cb3e937cd /users
parentsway: run swayidle and waybar via systemd (diff)
downloadworld-edb0fa477009492930f19d9aa20752a7dc6261e5.tar.gz
sway: need custom unit file for swayidle
I don't have access to
https://github.com/nix-community/home-manager/pull/2610 yet.
Diffstat (limited to 'users')
-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";
+    };
   };
 }