Compare commits

...

1 Commits

Author SHA1 Message Date
7662c04cda fix(hypridle): use Lua dpms dispatcher 2026-10-11 17:22:05 -04:00

View File

@@ -5,50 +5,32 @@
... ...
}: }:
# hypridle: idle-triggered locking and display power management. # hypridle: idle-triggered locking and display power management.
let
cfg = config.modules.desktop.session.hyprland.hypridle; # NOLINT(let_order)
# The guard drops the call when a locker is already up, so no idle trigger
# stacks a second hyprlock over the first.
lockCmd = "${pkgs.procps}/bin/pidof hyprlock || ${hyprlock}";
user = config.user.name;
hyprctl = "${config.programs.hyprland.package}/bin/hyprctl";
hyprlock = "${config.home-manager.users.${user}.programs.hyprlock.package}/bin/hyprlock";
in
{ {
options.modules.desktop.session.hyprland.hypridle = { options.modules.desktop.session.hyprland.hypridle.enable =
enable = lib.mkEnableOption "hypridle idle management"; lib.mkEnableOption "hypridle idle management";
lockTimeout = lib.mkOption { config = lib.mkIf config.modules.desktop.session.hyprland.hypridle.enable {
type = lib.types.ints.positive;
default = 300;
description = "Seconds of inactivity before the screen locks.";
};
};
config = lib.mkIf cfg.enable {
# Closing the lid suspends, and every suspend locks first through the # Closing the lid suspends, and every suspend locks first through the
# before_sleep_cmd below, so the lid always lands at a locked screen. # before_sleep_cmd below, so the lid always lands at a locked screen.
services.logind.settings.Login.HandleLidSwitch = "suspend"; services.logind.settings.Login.HandleLidSwitch = "suspend";
home-manager.users.${user}.services.hypridle = { home-manager.users.${config.user.name}.services.hypridle = {
enable = true; enable = true;
settings = { settings = {
general = { general = {
lock_cmd = lockCmd; # The guard drops the call when a locker is already up, so no idle
# trigger stacks a second hyprlock over the first.
lock_cmd = "${pkgs.procps}/bin/pidof hyprlock || ${pkgs.hyprlock}/bin/hyprlock";
before_sleep_cmd = "loginctl lock-session"; before_sleep_cmd = "loginctl lock-session";
# Waking pokes the compositor in case firmware leaves displays dark. # Waking pokes the compositor in case firmware leaves displays dark.
after_sleep_cmd = "${hyprctl} dispatch dpms on"; after_sleep_cmd = "${config.programs.hyprland.package}/bin/hyprctl dispatch 'hl.dsp.dpms({ action = \"enable\" })'";
}; };
listener = [ listener = [
# Lock on idle. # Lock on idle.
{ {
timeout = cfg.lockTimeout; timeout = 300;
on-timeout = "loginctl lock-session"; on-timeout = "loginctl lock-session";
} }
]; ];