Fix up swayidle config
This commit is contained in:
@@ -207,15 +207,54 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
services.swayidle = {
|
||||
services.swayidle =
|
||||
let
|
||||
lock = "${pkgs.swaylock-effects}/bin/swaylock --daemonize";
|
||||
# modify "display" function based on your window manager
|
||||
# Sway
|
||||
display = status: "${pkgs.sway}/bin/swaymsg 'output * power ${status}'";
|
||||
# Niri
|
||||
# display = status: "${pkgs.niri}/bin/niri msg action power-${status}-monitors";
|
||||
in
|
||||
{
|
||||
enable = true;
|
||||
timeouts = [
|
||||
{ timeout = 300; command = "swaylock -f"; }
|
||||
{ timeout = 600; command = "swaymsg \"output * dpms off\""; resumeCommand = "swaymsg \"output * dpms on\""; }
|
||||
{ timeout = 900; command = "systemctl suspend"; }
|
||||
{
|
||||
timeout = 295; # in seconds
|
||||
command = "${pkgs.libnotify}/bin/notify-send 'Locking in 5 seconds' -t 5000";
|
||||
}
|
||||
{
|
||||
timeout = 300;
|
||||
command = lock;
|
||||
}
|
||||
{
|
||||
timeout = 330;
|
||||
command = display "off";
|
||||
resumeCommand = display "on";
|
||||
}
|
||||
{
|
||||
timeout = 600;
|
||||
command = "${pkgs.systemd}/bin/systemctl suspend";
|
||||
}
|
||||
];
|
||||
events = [
|
||||
{ event = "before-sleep"; command = "swaylock -f"; }
|
||||
{
|
||||
event = "before-sleep";
|
||||
# adding duplicated entries for the same event may not work
|
||||
command = (display "off") + "; " + lock;
|
||||
}
|
||||
{
|
||||
event = "after-resume";
|
||||
command = display "on";
|
||||
}
|
||||
{
|
||||
event = "lock";
|
||||
command = (display "off") + "; " + lock;
|
||||
}
|
||||
{
|
||||
event = "unlock";
|
||||
command = display "on";
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user