home: swayidle: refactor
This commit is contained in:
parent
3aede98bd9
commit
1945d5aea6
1 changed files with 36 additions and 29 deletions
|
@ -1,40 +1,47 @@
|
||||||
{
|
{
|
||||||
pkgs,
|
pkgs,
|
||||||
lib,
|
lib,
|
||||||
|
config,
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
imports = [
|
imports = [
|
||||||
../swaylock
|
../swaylock
|
||||||
];
|
];
|
||||||
|
|
||||||
services = {
|
services.swayidle = let
|
||||||
swayidle = {
|
lock = lib.getExe config.programs.swaylock.package;
|
||||||
enable = true;
|
displayOn = ''${pkgs.sway}/bin/swaymsg "output * power on"'';
|
||||||
timeouts = [
|
displayOff = ''${pkgs.sway}/bin/swaymsg "output * power off"'';
|
||||||
{
|
in {
|
||||||
timeout = 900;
|
enable = true;
|
||||||
command = lib.getExe pkgs.swaylock-effects;
|
timeouts = [
|
||||||
} # lock screen
|
{
|
||||||
{
|
timeout = 60 * 9;
|
||||||
timeout = 905;
|
command = ''${pkgs.libnotify}/bin/notify-send -u critical --expire-time 60000 "60 seconds until lock!"'';
|
||||||
command = "${pkgs.sway}/bin/swaymsg \"output * dpms off\"";
|
}
|
||||||
resumeCommand = "${pkgs.sway}/bin/swaymsg \"output * dpms on\"";
|
{
|
||||||
} # turn off screen
|
timeout = 60 * 10;
|
||||||
{
|
command = lock;
|
||||||
timeout = 1200;
|
} # lock screen
|
||||||
command = ''systemctl suspend'';
|
{
|
||||||
} # suspend
|
timeout = 60 * 20;
|
||||||
];
|
command = displayOff;
|
||||||
events = [
|
resumeCommand = displayOn;
|
||||||
{
|
} # turn off screen
|
||||||
event = "lock";
|
{
|
||||||
command = lib.getExe pkgs.swaylock-effects;
|
timeout = 60 * 30;
|
||||||
} # loginctl lock-session
|
command = "systemctl suspend";
|
||||||
{
|
} # suspend
|
||||||
event = "before-sleep";
|
];
|
||||||
command = lib.getExe pkgs.swaylock-effects;
|
events = [
|
||||||
} # systemctl syspend
|
{
|
||||||
];
|
event = "lock";
|
||||||
};
|
command = lock;
|
||||||
|
} # loginctl lock-session
|
||||||
|
{
|
||||||
|
event = "before-sleep";
|
||||||
|
command = lock;
|
||||||
|
} # systemctl suspend
|
||||||
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue