compromise for no suspend
This commit is contained in:
parent
37c6c3371e
commit
4f2f4c9b52
3 changed files with 28 additions and 15 deletions
|
|
@ -42,6 +42,7 @@
|
||||||
pointer.enable = true;
|
pointer.enable = true;
|
||||||
tablet.enable = true;
|
tablet.enable = true;
|
||||||
networking.enable = true;
|
networking.enable = true;
|
||||||
|
rgb.enable = true;
|
||||||
};
|
};
|
||||||
dev = {
|
dev = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
|
||||||
|
|
@ -11,12 +11,7 @@ in {
|
||||||
default = inputs.hypridle.packages.${system}.hypridle;
|
default = inputs.hypridle.packages.${system}.hypridle;
|
||||||
example = "pkgs.hypridle";
|
example = "pkgs.hypridle";
|
||||||
};
|
};
|
||||||
desktop = mkEnableOption "Enable desktop tweaks (greatly extends the idle timeout)";
|
desktop = mkEnableOption "Extend screen dimming time and disable sleeping";
|
||||||
desktopMultiplier = mkOption {
|
|
||||||
type = types.int;
|
|
||||||
default = 10;
|
|
||||||
example = 10;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
|
|
@ -30,12 +25,17 @@ in {
|
||||||
lock_cmd = "${pkgs.procps}/bin/pidof hyprlock || ${lib.getExe config.modules.desktop.hyprlock.package}";
|
lock_cmd = "${pkgs.procps}/bin/pidof hyprlock || ${lib.getExe config.modules.desktop.hyprlock.package}";
|
||||||
unlock_cmd = "${pkgs.procps}/bin/pkill -USR1 hyprlock";
|
unlock_cmd = "${pkgs.procps}/bin/pkill -USR1 hyprlock";
|
||||||
|
|
||||||
before_sleep_cmd = "${pkgs.systemd}/bin/loginctl lock-session"; # lock the screen before sleeping
|
before_sleep_cmd = "${pkgs.systemd}/bin/loginctl lock-session";
|
||||||
};
|
};
|
||||||
|
|
||||||
listener = let
|
listener = [
|
||||||
toDesktopTimeout = t: if cfg.desktop then t * cfg.desktopMultiplier else t;
|
{
|
||||||
in [
|
timeout = if !cfg.desktop
|
||||||
|
then 60 * 2 # 2 min
|
||||||
|
else 60 * 35; # 35 min
|
||||||
|
on-timeout = "${pkgs.systemd}/bin/loginctl lock-session"; # lock computer
|
||||||
|
}
|
||||||
|
] ++ optionals (!cfg.desktop) [
|
||||||
{
|
{
|
||||||
timeout = toDesktopTimeout 60; # 1 min
|
timeout = toDesktopTimeout 60; # 1 min
|
||||||
on-timeout = "${lib.getExe pkgs.brightnessctl} -c backlight -s set 20"; # dim screen, save brightness state
|
on-timeout = "${lib.getExe pkgs.brightnessctl} -c backlight -s set 20"; # dim screen, save brightness state
|
||||||
|
|
@ -46,16 +46,14 @@ in {
|
||||||
on-timeout = "${lib.getExe pkgs.brightnessctl} -d '*:kbd_backlight' -s set 0"; # turn off keyboard backlight, save state
|
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
|
on-resume = "${lib.getExe pkgs.brightnessctl} -d '*:kbd_backlight' -r"; # restore previous keyboard backlight state
|
||||||
}
|
}
|
||||||
{
|
|
||||||
timeout = toDesktopTimeout (60 * 2); # 2 min
|
|
||||||
on-timeout = "${pkgs.systemd}/bin/loginctl lock-session"; # lock computer
|
|
||||||
}
|
|
||||||
{
|
{
|
||||||
timeout = toDesktopTimeout (60 * 15); # 15 min
|
timeout = toDesktopTimeout (60 * 15); # 15 min
|
||||||
on-timeout = "${pkgs.systemd}/bin/systemctl suspend"; # sleep/suspend
|
on-timeout = "${pkgs.systemd}/bin/systemctl suspend"; # sleep/suspend
|
||||||
}
|
}
|
||||||
] ++ optional config.modules.desktop.niri.enable {
|
] ++ optional config.modules.desktop.niri.enable {
|
||||||
timeout = toDesktopTimeout (60 + 30); # 1.5 min
|
timeout = if !cfg.desktop
|
||||||
|
then 90 # 1.5 min
|
||||||
|
else 30 * 60; # 30 min
|
||||||
on-timeout = "niri msg action power-off-monitors";
|
on-timeout = "niri msg action power-off-monitors";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
14
modules/hardware/rgb.nix
Normal file
14
modules/hardware/rgb.nix
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
{ pkgs, config, lib, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
let
|
||||||
|
cfg = config.modules.hardware.rgb;
|
||||||
|
in {
|
||||||
|
options.modules.hardware.rgb = {
|
||||||
|
enable = mkEnableOption "Enable support for rgb devices through openrgb";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
services.hardware.openrgb.enable = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue