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;
|
||||||
|
displayOn = ''${pkgs.sway}/bin/swaymsg "output * power on"'';
|
||||||
|
displayOff = ''${pkgs.sway}/bin/swaymsg "output * power off"'';
|
||||||
|
in {
|
||||||
enable = true;
|
enable = true;
|
||||||
timeouts = [
|
timeouts = [
|
||||||
{
|
{
|
||||||
timeout = 900;
|
timeout = 60 * 9;
|
||||||
command = lib.getExe pkgs.swaylock-effects;
|
command = ''${pkgs.libnotify}/bin/notify-send -u critical --expire-time 60000 "60 seconds until lock!"'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
timeout = 60 * 10;
|
||||||
|
command = lock;
|
||||||
} # lock screen
|
} # lock screen
|
||||||
{
|
{
|
||||||
timeout = 905;
|
timeout = 60 * 20;
|
||||||
command = "${pkgs.sway}/bin/swaymsg \"output * dpms off\"";
|
command = displayOff;
|
||||||
resumeCommand = "${pkgs.sway}/bin/swaymsg \"output * dpms on\"";
|
resumeCommand = displayOn;
|
||||||
} # turn off screen
|
} # turn off screen
|
||||||
{
|
{
|
||||||
timeout = 1200;
|
timeout = 60 * 30;
|
||||||
command = ''systemctl suspend'';
|
command = "systemctl suspend";
|
||||||
} # suspend
|
} # suspend
|
||||||
];
|
];
|
||||||
events = [
|
events = [
|
||||||
{
|
{
|
||||||
event = "lock";
|
event = "lock";
|
||||||
command = lib.getExe pkgs.swaylock-effects;
|
command = lock;
|
||||||
} # loginctl lock-session
|
} # loginctl lock-session
|
||||||
{
|
{
|
||||||
event = "before-sleep";
|
event = "before-sleep";
|
||||||
command = lib.getExe pkgs.swaylock-effects;
|
command = lock;
|
||||||
} # systemctl syspend
|
} # systemctl suspend
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue