feat(hyprlock): add idle lock inhibit toggle #56
@@ -11,6 +11,26 @@ let
|
|||||||
|
|
||||||
# The hyprlock this module installs, used by the lock keybind below.
|
# The hyprlock this module installs, used by the lock keybind below.
|
||||||
hyprlock = "${config.home-manager.users.${user}.programs.hyprlock.package}/bin/hyprlock";
|
hyprlock = "${config.home-manager.users.${user}.programs.hyprlock.package}/bin/hyprlock";
|
||||||
|
|
||||||
|
idleLockToggle = pkgs.writeShellScript "lockscreen-idle-inhibit-toggle" ''
|
||||||
|
unit=lockscreen-idle-inhibit.service
|
||||||
|
|
||||||
|
if ${pkgs.systemd}/bin/systemctl --user is-active --quiet "$unit"; then
|
||||||
|
${pkgs.systemd}/bin/systemctl --user stop "$unit"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
${pkgs.systemd}/bin/systemd-run \
|
||||||
|
--user \
|
||||||
|
--collect \
|
||||||
|
--unit=lockscreen-idle-inhibit \
|
||||||
|
--description="Disable idle-triggered screen locking" \
|
||||||
|
${pkgs.systemd}/bin/systemd-inhibit \
|
||||||
|
--what=idle \
|
||||||
|
--who=lockscreen-hotkey \
|
||||||
|
--why="lock screen disabled by hotkey" \
|
||||||
|
${pkgs.coreutils}/bin/sleep infinity
|
||||||
|
'';
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.modules.desktop.hyprland.hyprlock.enable = lib.mkEnableOption "the hyprlock lock screen";
|
options.modules.desktop.hyprland.hyprlock.enable = lib.mkEnableOption "the hyprlock lock screen";
|
||||||
@@ -55,6 +75,7 @@ in
|
|||||||
# hyprlock never stacks over the first.
|
# hyprlock never stacks over the first.
|
||||||
wayland.windowManager.hyprland.settings.bind = [
|
wayland.windowManager.hyprland.settings.bind = [
|
||||||
"$mod, X, exec, ${pkgs.procps}/bin/pidof hyprlock || ${hyprlock}"
|
"$mod, X, exec, ${pkgs.procps}/bin/pidof hyprlock || ${hyprlock}"
|
||||||
|
"$mod CTRL, X, exec, ${idleLockToggle}"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user