Let hypridle handle screen lock before suspend

This commit is contained in:
SebastianStork 2025-02-26 22:06:03 +01:00
parent 148807589c
commit dc57acb9d8
6 changed files with 17 additions and 14 deletions

View file

@ -12,7 +12,6 @@
home.packages = [
wrappers.hyprlock
pkgs.brightnessctl
(pkgs.writeScriptBin "lock-suspend" "loginctl lock-session && sleep 0.5 && systemctl suspend-then-hibernate")
];
services.hypridle = {
@ -21,6 +20,7 @@
settings = {
general = {
lock_cmd = "pidof hyprlock || hyprlock";
before_sleep_cmd = "loginctl lock-session";
after_sleep_cmd = "hyprctl dispatch dpms on";
};
@ -41,7 +41,7 @@
}
{
timeout = 1800;
on-timeout = "lock-suspend";
on-timeout = "systemctl suspend${lib.optionalString config.myConfig.hibernation.enable "-then-hibernate"}";
}
];
};

View file

@ -8,6 +8,7 @@
# l = locked
# Variables
$suspend = systemctl suspend${lib.optionalString config.myConfig.hibernation.enable "-then-hibernate"}
$play-pause = playerctl --ignore-player=firefox play-pause
$play-next = playerctl --ignore-player=firefox next
$play-previous = playerctl --ignore-player=firefox previous
@ -61,9 +62,9 @@
bindrl = SUPER CONTROL, Q, exit,
bindrl = SUPER CONTROL, P, exec, poweroff
bindrl = SUPER CONTROL, R, exec, reboot
bindrl = SUPER CONTROL, H, exec, systemctl hibernate
bindrl = SUPER CONTROL, S, exec, lock-suspend
bindl = , switch:on:Lid Switch, exec, lock-suspend
${lib.optionalString config.myConfig.hibernation.enable "bindrl = SUPER CONTROL, H, exec, systemctl hibernate"}
bindrl = SUPER CONTROL, S, exec, $suspend
bindl = , switch:on:Lid Switch, exec, $suspend
bindrl = SUPER CONTROL, L, exec, loginctl lock-session
bindrl = SUPER CONTROL, B, exec, sleep 1 && hyprctl dispatch dpms off

View file

@ -0,0 +1,4 @@
{ lib, ... }:
{
options.myConfig.hibernation.enable = lib.mkEnableOption "";
}

View file

@ -6,7 +6,7 @@
services.geoclue2 = {
enable = true;
geoProviderUrl = "https://beacondb.net/v1/geolocate";
appConfig.gammastep = {
isAllowed = true;
isSystem = false;