Use systemctl sleep for automatic suspend mode selection

This commit is contained in:
SebastianStork 2025-03-10 18:45:18 +01:00
parent 1b27e93c03
commit 86d31cc3c6
5 changed files with 6 additions and 17 deletions

View file

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

View file

@ -37,7 +37,7 @@
} }
{ {
timeout = 1800; timeout = 1800;
on-timeout = "systemctl suspend${lib.optionalString config.myConfig.hibernation.enable "-then-hibernate"}"; on-timeout = "systemctl sleep";
} }
]; ];
}; };

View file

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

View file

@ -3,10 +3,7 @@
home.stateVersion = "24.11"; home.stateVersion = "24.11";
myConfig = { myConfig.theme = "light";
theme = "light";
hibernation.enable = true;
};
wayland.windowManager.hyprland.settings.monitor = [ wayland.windowManager.hyprland.settings.monitor = [
"eDP-1,2880x1920@120,0x0,2,vrr,1" "eDP-1,2880x1920@120,0x0,2,vrr,1"

View file

@ -4,10 +4,7 @@
home.stateVersion = "23.11"; home.stateVersion = "23.11";
myConfig = { myConfig.theme = "dark";
theme = "dark";
hibernation.enable = true;
};
home.packages = [ home.packages = [
pkgs.ffmpeg pkgs.ffmpeg