Swayidle: Difference between revisions
mNo edit summary |
No edit summary |
||
| Line 18: | Line 18: | ||
# Suspend the system | # Suspend the system | ||
which could be set using {{ic|services.swayidle.timeouts}}. | which could be set using {{ic|services.swayidle.timeouts}}. {{ic|services.swayidle.events}} is useful to make the behavior consistent with the above in case {{ic|systemctl suspend}}, {{ic|loginctl lock-session}} are manually run. | ||
{{ic|services.swayidle.events}} is useful in case | |||
{{file|~/.config/home-manager/home.nix|nix|3= | {{file|~/.config/home-manager/home.nix|nix|3= | ||
services.swayidle = | services.swayidle = | ||
let | let | ||
# Lock command | |||
lock = "${pkgs.swaylock}/bin/swaylock --daemonize"; | |||
# Sway | # Sway | ||
display = status: "swaymsg 'output * power ${status}'"; \ | display = status: "swaymsg 'output * power ${status}'"; \ | ||
| Line 41: | Line 41: | ||
{ | { | ||
timeout = 20; | timeout = 20; | ||
command = | command = lock; | ||
} | } | ||
{ | { | ||
| Line 60: | Line 60: | ||
{ | { | ||
event = "before-sleep"; | event = "before-sleep"; | ||
command = | command = lock; | ||
} | } | ||
{ | { | ||
event = "after-resume"; | event = "after-resume"; | ||
command = display "on"; | command = display "on"; | ||
} | |||
{ | |||
event = "lock"; | |||
command = lock; | |||
} | } | ||
{ | { | ||