Charlotte 🦝 Delenk
cedfa6b6cd
All checks were successful
Hydra nixosConfigurations.oracle-installer Hydra build #27465 of nixos-config:pr618:nixosConfigurations.oracle-installer
Hydra nixosConfigurations.thinkrac Hydra build #27468 of nixos-config:pr618:nixosConfigurations.thinkrac
Hydra nixosConfigurations.rainbow-resort Hydra build #27467 of nixos-config:pr618:nixosConfigurations.rainbow-resort
Hydra nixosConfigurations.pc-installer Hydra build #27466 of nixos-config:pr618:nixosConfigurations.pc-installer
54 lines
1.2 KiB
Nix
54 lines
1.2 KiB
Nix
{ pkgs, ... }:
|
|
let
|
|
lock-script = pkgs.writeScript "suspend" ''
|
|
${pkgs.swaylock}/bin/swaylock -f -c 000000
|
|
${pkgs.mpc-cli}/bin/mpc pause
|
|
'';
|
|
screen-off-script = pkgs.writeScript "screenOff" ''
|
|
${pkgs.sway}/bin/swaymsg "output * dpms off"
|
|
'';
|
|
suspend-script = pkgs.writeScript "suspend" ''
|
|
${pkgs.systemd}/bin/systemctl suspend
|
|
'';
|
|
resume-script = pkgs.writeScript "resume" ''
|
|
${pkgs.sway}/bin/swaymsg "output * dpms on"
|
|
'';
|
|
unlock-script = pkgs.writeScript "unlock" ''
|
|
${pkgs.procps}/bin/pkill swaylock
|
|
${pkgs.mpc-cli}/bin/mpc play
|
|
'';
|
|
in
|
|
{
|
|
services.swayidle = {
|
|
enable = true;
|
|
events = [
|
|
{
|
|
event = "before-sleep";
|
|
command = "${lock-script}";
|
|
}
|
|
{
|
|
event = "lock";
|
|
command = "${lock-script}";
|
|
}
|
|
{
|
|
event = "unlock";
|
|
command = "${unlock-script}";
|
|
}
|
|
];
|
|
timeouts = [
|
|
{
|
|
timeout = 300;
|
|
command = "${lock-script}";
|
|
}
|
|
{
|
|
timeout = 305;
|
|
command = "${screen-off-script}";
|
|
resumeCommand = "${resume-script}";
|
|
}
|
|
{
|
|
timeout = 900;
|
|
command = "${suspend-script}";
|
|
}
|
|
];
|
|
};
|
|
}
|