feat[client]: add swayidle

This commit is contained in:
Leon Schwarzäugl 2025-10-11 23:26:20 +02:00
parent 116a099732
commit 870c55b889
Signed by: swarsel
GPG key ID: 26A54C31F2A4FD84
4 changed files with 74 additions and 4 deletions

View file

@ -0,0 +1,33 @@
{ lib, config, pkgs, ... }:
let
moduleName = "swayidle";
in
{
options.swarselmodules.${moduleName} = lib.mkEnableOption "enable ${moduleName} and settings";
config = lib.mkIf config.swarselmodules.${moduleName} {
services.${moduleName} =
let
brightnessctl = "${lib.getExe pkgs.brightnessctl}";
swaylock = "${lib.getExe pkgs.swaylock-effects}";
suspend = "${pkgs.systemd}/bin/systemctl";
in
{
enable = true;
systemdTarget = config.wayland.systemd.target;
extraArgs = [ "-w" ];
timeouts = [
{ timeout = 60; command = "${brightnessctl} -s; ${brightnessctl} set 80%-"; resumeCommand = "${brightnessctl} -r"; }
# { timeout = 300; command = "${lib.getExe pkgs.swaylock-effects} -f --screenshots --clock --effect-blur 7x5 --effect-vignette 0.5:0.5 --fade-in 0.2"; }
{ timeout = 300; command = "${swaylock} -f"; }
# { timeout = 600; command = ''${pkgs.sway}/bin/swaymsg "output * dpms off"; resumeCommand = "${pkgs.sway}/bin/swaymsg output * dpms on''; }
{ timeout = 600; command = "${suspend}"; }
];
events = [
# { event = "before-sleep"; command = "${lib.getExe pkgs.swaylock-effects} -f --screenshots --clock --effect-blur 7x5 --effect-vignette 0.5:0.5 --fade-in 0.2"; }
{ event = "before-sleep"; command = "${swaylock} -f "; }
{ event = "lock"; command = "${swaylock} -f "; }
];
};
};
}