yep, more dotfiles

sway: update idle config deamon

wiro.world 3310a80a fcc2447c

verified
+31 -23
+26 -20
home-manager/fragments/sway.nix
··· 25 25 programs.swaylock = { 26 26 enable = true; 27 27 settings = { 28 - daemonize = true; 29 28 ignore-empty-password = true; 30 29 show-failed-attempts = true; 31 30 ··· 71 70 72 71 services.swayidle = 73 72 let 74 - swaymsg = lib.getExe' config.wayland.windowManager.sway.package "swaymsg"; 75 73 loginctl = lib.getExe' pkgs.systemd "loginctl"; 76 - systemctl = lib.getExe' pkgs.systemd "systemctl"; 74 + playerctl = lib.getExe pkgs.playerctl; 75 + swaymsg = lib.getExe' config.wayland.windowManager.sway.package "swaymsg"; 76 + 77 + display = status: ''${swaymsg} "output * power ${status}"''; 78 + lock = "${lib.getExe config.programs.swaylock.package} --daemonize"; 77 79 in 78 80 { 79 81 enable = true; 82 + 80 83 timeouts = [ 81 - # TODO: this doesn't work find a way to quickly cut output when locked and idle 82 - # { 83 - # timeout = 10; 84 - # command = "if ${pgrep} -x swaylock; then ${swaymsg} \"output * power off\"; fi"; 85 - # resumeCommand = "${swaymsg} \"output * power on\""; 86 - # } 87 - 84 + { 85 + # Dims the screen for X seconds and then switch it off 86 + timeout = 5 * 60 - 10; 87 + command = ''${lib.getExe pkgs.chayang} -d${toString 10}''; 88 + } 89 + { 90 + timeout = 5 * 60; 91 + command = display "off"; 92 + resumeCommand = display "on"; 93 + } 94 + { 95 + timeout = 10 * 60; 96 + command = "${loginctl} lock-session"; 97 + } 88 98 { 89 - timeout = 60 * 5; 90 - # ——————————————— Dims the screen for n seconds ↓↓ and then switch it off 91 - command = ''${lib.getExe pkgs.chayang} -d${toString 10} && ${swaymsg} "output * power off"''; 92 - resumeCommand = ''${swaymsg} "output * power on"''; 99 + timeout = 15 * 60; 100 + command = "${lib.getExe' pkgs.systemd "systemctl"} suspend"; 93 101 } 94 - { timeout = 60 * 10; command = "${loginctl} lock-session"; } 95 - { timeout = 60 * 15; command = "${systemctl} suspend"; } 96 102 ]; 97 103 events = [ 98 - { event = "before-sleep"; command = "${lib.getExe pkgs.playerctl} pause"; } 99 - { event = "before-sleep"; command = "${loginctl} lock-session"; } 100 - # Can be triggered with `loginctl lock-session` 101 - { event = "lock"; command = lib.getExe pkgs.swaylock; } 104 + { event = "before-sleep"; command = "${playerctl} pause; ${display "off"}; ${loginctl} lock-session"; } 105 + { event = "after-resume"; command = display "on"; } 106 + { event = "lock"; command = lock; } 107 + { event = "unlock"; command = display "on"; } 102 108 ]; 103 109 }; 104 110
+5 -3
nixos/fragments/security.nix
··· 23 23 # Systemd Login 24 24 services.logind.settings.Login = { 25 25 HandleLidSwitch = "suspend"; 26 - IdleAction = "lock"; 26 + IdleAction = "ignore"; 27 + # IdleAction = "lock"; 27 28 # Don’t shutdown when power button is short-pressed 28 - HandlePowerKey = "lock"; 29 - HandlePowerKeyLongPress = "suspend"; 29 + HandlePowerKey = "suspend"; 30 + # i have no long press on neo-wiro-laptop 31 + HandlePowerKeyLongPress = "ignore"; 30 32 }; 31 33 32 34 # `swaylock` pam service must be at least declared to work properly