mirror of
https://github.com/ItsDrike/nixdots
synced 2025-06-29 08:20:43 +00:00
Add hypridle & hyprlock
This commit is contained in:
parent
c7bb1768be
commit
8b0bd140db
8 changed files with 279 additions and 0 deletions
|
@ -2,5 +2,6 @@ _: {
|
|||
imports = [
|
||||
./dunst.nix
|
||||
./hyprpaper.nix
|
||||
./hypridle.nix
|
||||
];
|
||||
}
|
||||
|
|
56
home/services/hypridle.nix
Normal file
56
home/services/hypridle.nix
Normal file
|
@ -0,0 +1,56 @@
|
|||
{
|
||||
lib,
|
||||
osConfig,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf;
|
||||
|
||||
cfg = osConfig.myOptions.home-manager.services.hypridle;
|
||||
cfgIsWayland = osConfig.myOptions.home-manager.wms.isWayland;
|
||||
in {
|
||||
config = mkIf (cfg.enable && cfgIsWayland) {
|
||||
# NOTE: This assumes dunst, hyprlock and Hyprland are installed
|
||||
services.hypridle = {
|
||||
enable = true;
|
||||
settings = {
|
||||
general = {
|
||||
lock_cmd = "hyprlock && dunstctl set-paused true";
|
||||
unlock_cmd = "killall -s SIGUSR1 hyprlock && dustctl set-paused false";
|
||||
before_sleep_cmd = "loginctl lock-session && dunstctl set-paused true && sleep 2";
|
||||
after_sleep_cmd = "dunstctl set-paused false";
|
||||
ignore_dbus_inhibit = false;
|
||||
ignore_systemd_inhibit = false;
|
||||
};
|
||||
|
||||
listener = [
|
||||
# Warn about going idle (5 mins)
|
||||
{
|
||||
timeout = 300;
|
||||
# use hyprland notifications, in case dunst notifs are paused or whatever
|
||||
on-timeout = "hyprctl notify 0 10000 'rgb(ff0000)' 'fontsize:20 System going idle in 10 seconds...'";
|
||||
on-resume = "hyprctl dismissnotify 1";
|
||||
}
|
||||
|
||||
# Lock the session & disable dunst notifications
|
||||
{
|
||||
timeout = 310;
|
||||
on-timeout = "loginctl lock-session";
|
||||
}
|
||||
|
||||
# Turn off the screen after another 50s
|
||||
{
|
||||
timeout = 400;
|
||||
on-timeout = "hyprctl dispatch dpms off";
|
||||
on-resume = "hyprctl dispatch dpms on";
|
||||
}
|
||||
|
||||
# Enter suspend/sleep state (10 minutes)
|
||||
{
|
||||
timeout = 600;
|
||||
on-timeout = "systemctl suspend-then-hibernate";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue