From edb0fa477009492930f19d9aa20752a7dc6261e5 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sun, 13 Feb 2022 13:06:07 -0800 Subject: sway: need custom unit file for swayidle I don't have access to https://github.com/nix-community/home-manager/pull/2610 yet. --- users/fcuny/desktop/sway/sway-idle.nix | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'users/fcuny/desktop/sway') 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"; + }; }; } -- cgit 1.4.1