Swayidle: Difference between revisions
No edit summary |
Fix swaymsg package (prior to this change: `swaymsg: command not found`) |
||
| (6 intermediate revisions by 2 users not shown) | |||
| Line 14: | Line 14: | ||
# Send notification before doing the following | # Send notification before doing the following | ||
# Lock screen | # Lock screen (typically [[Swaylock]] is used) | ||
# Turn off the screen (Note that the command may differ among window managers) | # Turn off the screen (Note that the command may differ among window managers) | ||
# Suspend the system | # Suspend the system | ||
| Line 25: | Line 25: | ||
# Lock command | # Lock command | ||
lock = "${pkgs.swaylock}/bin/swaylock --daemonize"; | lock = "${pkgs.swaylock}/bin/swaylock --daemonize"; | ||
# TODO: modify "display" function based on your window manager | |||
# Sway | # Sway | ||
display = status: "swaymsg 'output * power ${status}'"; | display = status: "${pkgs.sway}/bin/swaymsg 'output * power ${status}'"; | ||
# Hyprland | # Hyprland | ||
# display = status: "hyprctl dispatch dpms ${status}"; | # display = status: "hyprctl dispatch dpms ${status}"; | ||
| Line 36: | Line 37: | ||
timeouts = [ | timeouts = [ | ||
{ | { | ||
timeout = 15; | timeout = 15; # in seconds | ||
command = "${pkgs.libnotify}/bin/notify-send 'Locking in 5 seconds' -t 5000"; | command = "${pkgs.libnotify}/bin/notify-send 'Locking in 5 seconds' -t 5000"; | ||
} | } | ||
| Line 56: | Line 57: | ||
{ | { | ||
event = "before-sleep"; | event = "before-sleep"; | ||
command = display "off"; | # adding duplicated entries for the same event may not work | ||
command = (display "off") + "; " + lock; | |||
} | } | ||
{ | { | ||
| Line 68: | Line 66: | ||
{ | { | ||
event = "lock"; | event = "lock"; | ||
command = | command = (display "off") + "; " + lock; | ||
} | } | ||
{ | { | ||
| Line 80: | Line 74: | ||
]; | ]; | ||
}; | }; | ||
}} | |name=~/.config/home-manager/home.nix|lang=nix}} | ||
See [https://man.archlinux.org/man/extra/swayidle/swayidle.1.en the man page] for further information. | |||