✨ Moved modules and hm dir to hosts dir. Moved some code to shared and extended lib with custom functions
This commit is contained in:
38
hosts/desktop/home-manager/hyprland/hypridle/default.nix
Normal file
38
hosts/desktop/home-manager/hyprland/hypridle/default.nix
Normal file
@ -0,0 +1,38 @@
|
||||
let
|
||||
# Time in seconds
|
||||
lockAfter = 1200;
|
||||
screenOffAfter = 1500;
|
||||
suspendAfter = 7200;
|
||||
in
|
||||
{
|
||||
services.hypridle = {
|
||||
enable = true;
|
||||
settings = {
|
||||
general = {
|
||||
before_sleep_cmd = "loginctl lock-session";
|
||||
after_sleep_cmd = "hyprctl dispatch dpms on";
|
||||
lock_cmd = "pidof hyprlock || hyprlock"; # Avoid running multiple instances of hyprlock
|
||||
};
|
||||
|
||||
listener = [
|
||||
# Lock
|
||||
{
|
||||
timeout = lockAfter;
|
||||
on-timeout = "loginctl lock-session";
|
||||
}
|
||||
# Turn off screens
|
||||
{
|
||||
timeout = screenOffAfter;
|
||||
on-timeout = "hyprctl dispatch dpms off";
|
||||
on-resume = "hyprctl dispatch dpms on";
|
||||
}
|
||||
# Suspend
|
||||
{
|
||||
timeout = suspendAfter;
|
||||
on-timeout = "systemctl suspend"; # suspend pc
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
wayland.windowManager.hyprland.settings.exec-once = [ "hypridle" ];
|
||||
}
|
Reference in New Issue
Block a user