new wm, hyprland gone

This commit is contained in:
Reid 2025-05-18 23:05:26 -07:00
parent 003f37bfbd
commit cb4b22b4e5
Signed by: reidlab
GPG key ID: DAF5EAF6665839FD
41 changed files with 1145 additions and 1364 deletions

View file

@ -5,12 +5,18 @@ let
cfg = config.modules.desktop.hypridle;
in {
options.modules.desktop.hypridle = {
enable = mkEnableOption "Enable hypridle, hyprland's idle daemon";
enable = mkEnableOption "Enable hypridle, a wayland idle daemon";
package = mkOption {
type = types.package;
default = inputs.hypridle.packages.${system}.hypridle;
example = "pkgs.hypridle";
};
desktop = mkEnableOption "Enable desktop tweaks (greatly extends the idle timeout)";
desktopMultiplier = mkOption {
type = types.int;
default = 10;
example = 10;
};
};
config = mkIf cfg.enable {
@ -27,32 +33,31 @@ in {
before_sleep_cmd = "${pkgs.systemd}/bin/loginctl lock-session"; # lock the screen before sleeping
};
listener = [
listener = let
toDesktopTimeout = t: if cfg.desktop then t * cfg.desktopMultiplier else t;
in [
{
timeout = 60;
timeout = toDesktopTimeout 60; # 1 min
on-timeout = "${lib.getExe pkgs.brightnessctl} -c backlight -s set 20"; # dim screen, save brightness state
on-resume = "${lib.getExe pkgs.brightnessctl} -c backlight -r"; # restore previous screen brightness state
}
{
timeout = 60;
timeout = toDesktopTimeout 60; # 1 min
on-timeout = "${lib.getExe pkgs.brightnessctl} -d '*:kbd_backlight' -s set 0"; # turn off keyboard backlight, save state
on-resume = "${lib.getExe pkgs.brightnessctl} -d '*:kbd_backlight' -r"; # restore previous keyboard backlight state
}
{
timeout = 60 * 2; # 2 min
timeout = toDesktopTimeout (60 * 2); # 2 min
on-timeout = "${pkgs.systemd}/bin/loginctl lock-session"; # lock computer
}
{
timeout = 60 * 15; # 15 min
timeout = toDesktopTimeout (60 * 15); # 15 min
on-timeout = "${pkgs.systemd}/bin/systemctl suspend"; # sleep/suspend
}
] ++ optional config.modules.desktop.hyprland.enable (let
hyprctl = "${config.modules.desktop.hyprland.package}/bin/hyprctl";
in {
timeout = 90; # 1.5 min
on-timeout = "${hyprctl} dispatch dpms off"; # turn off screen
on-resume = "${hyprctl} dispatch dpms on"; # turn it back on
});
] ++ optional config.modules.desktop.niri.enable {
timeout = toDesktopTimeout (60 + 30); # 1.5 min
on-timeout = "niri msg action power-off-monitors";
};
};
};
};