actually fix locking and idle, fr this time

This commit is contained in:
Reid 2024-04-25 23:46:42 -07:00
parent 085d68b27d
commit 2aa9e86a5d
2 changed files with 13 additions and 10 deletions

View file

@ -14,16 +14,18 @@ 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 || ${config.modules.desktop.hyprland.package}/bin/hyprctl dispatch exec ${lib.getExe config.modules.desktop.hyprlock.package}"; lockCmd = "${pkgs.procps}/bin/pidof hyprlock || ${hyprctl} dispatch exec ${lib.getExe config.modules.desktop.hyprlock.package}";
unlockCmd = "${pkgs.procps}/bin/pkill -USR1 hyprlock"; unlockCmd = "${pkgs.procps}/bin/pkill -USR1 hyprlock";
listeners = let beforeSleepCmd = "${pkgs.systemd}/bin/loginctl lock-session";
hyprctl = "${config.modules.desktop.hyprland.package}/bin/hyprctl";
in [ listeners = [
{ {
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
@ -31,11 +33,11 @@ in {
} }
{ {
timeout = 60 * 2; # 2 min timeout = 60 * 2; # 2 min
onTimeout = "loginctl lock-session"; # lock computer onTimeout = "${pkgs.systemd}/bin/loginctl lock-session"; # lock computer
} }
{ {
timeout = 60 * 30; # 30 min timeout = 60 * 30; # 30 min
onTimeout = "systemctl suspend"; # sleep/suspend onTimeout = "${pkgs.systemd}/bin/systemctl suspend"; # sleep/suspend
} }
]; ];
}; };

View file

@ -15,17 +15,16 @@ in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
security.pam.services.hyprlock.text = "auth include login"; security.pam.services.hyprlock.text = "auth include login";
powerManagement.resumeCommands = ''
${pkgs.procps}/bin/pidof hyprlock || ${lib.getExe cfg.package}
'';
hm.programs.hyprlock = with config.colorScheme.palette; { hm.programs.hyprlock = with config.colorScheme.palette; {
enable = true; enable = true;
package = cfg.package; package = cfg.package;
general = { general = {
hide_cursor = false; hide_cursor = false;
no_fade_in = true; no_fade_in = true;
no_fade_out = true; no_fade_out = true;
}; };
backgrounds = [ backgrounds = [
{ {
path = toString ../../assets/lockscreen.png; path = toString ../../assets/lockscreen.png;
@ -33,6 +32,7 @@ in {
blur_size = 6; blur_size = 6;
} }
]; ];
labels = [ labels = [
{ {
text = "cmd[update:1000] echo \"$(date +'%H:%M')\""; text = "cmd[update:1000] echo \"$(date +'%H:%M')\"";
@ -49,6 +49,7 @@ in {
position = { x = 0; y = 10; }; position = { x = 0; y = 10; };
} }
]; ];
input-fields = [ input-fields = [
{ {
size = { width = 300; height = 28; }; size = { width = 300; height = 28; };