hypridle brightness and monitor changes
This commit is contained in:
parent
d51abe2b37
commit
fae3d16162
1 changed files with 12 additions and 6 deletions
|
@ -14,18 +14,24 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
hm.services.hypridle = {
|
hm.services.hypridle = let
|
||||||
|
hyprctl = "${config.modules.desktop.hyprland.package}/bin/hyprctl";
|
||||||
|
in {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = cfg.package;
|
package = cfg.package;
|
||||||
|
|
||||||
lockCmd = "${pkgs.procps}/bin/pidof hyprlock || ${lib.getExe config.modules.desktop.hyprlock.package}";
|
lockCmd = "${pkgs.procps}/bin/pidof hyprlock || ${lib.getExe config.modules.desktop.hyprlock.package}";
|
||||||
unlockCmd = "${pkgs.procps}/bin/pkill -USR1 hyprlock";
|
unlockCmd = "${pkgs.procps}/bin/pkill -USR1 hyprlock";
|
||||||
|
|
||||||
beforeSleepCmd = "${pkgs.systemd}/bin/loginctl lock-session";
|
beforeSleepCmd = "${pkgs.systemd}/bin/loginctl lock-session"; # lock the screen before sleeping
|
||||||
|
afterSleepCmd = "${hyprctl} dispatch dpms on"; # turn on the screen to avoid moving mouse/pressing key
|
||||||
|
|
||||||
listeners = let
|
listeners = [
|
||||||
hyprctl = "${config.modules.desktop.hyprland.package}/bin/hyprctl";
|
{
|
||||||
in [
|
timeout = 60 * 1;
|
||||||
|
onTimeout = "${lib.getExe pkgs.brightnessctl} -c backlight -s set 20"; # dim screen, save brightness state
|
||||||
|
onResume = "${lib.getExe pkgs.brightnessctl} -c backlight -r"; # restore previous screen brightness state
|
||||||
|
}
|
||||||
{
|
{
|
||||||
timeout = 90; # 1.5 min
|
timeout = 90; # 1.5 min
|
||||||
onTimeout = "${hyprctl} dispatch dpms off"; # turn off screen
|
onTimeout = "${hyprctl} dispatch dpms off"; # turn off screen
|
||||||
|
@ -36,7 +42,7 @@ in {
|
||||||
onTimeout = "${pkgs.systemd}/bin/loginctl lock-session"; # lock computer
|
onTimeout = "${pkgs.systemd}/bin/loginctl lock-session"; # lock computer
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
timeout = 60 * 30; # 30 min
|
timeout = 60 * 15; # 15 min
|
||||||
onTimeout = "${pkgs.systemd}/bin/systemctl suspend"; # sleep/suspend
|
onTimeout = "${pkgs.systemd}/bin/systemctl suspend"; # sleep/suspend
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue