mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 15:11:34 +01:00
Let hypridle handle screen lock before suspend
This commit is contained in:
parent
148807589c
commit
dc57acb9d8
6 changed files with 17 additions and 14 deletions
|
|
@ -12,7 +12,6 @@
|
||||||
home.packages = [
|
home.packages = [
|
||||||
wrappers.hyprlock
|
wrappers.hyprlock
|
||||||
pkgs.brightnessctl
|
pkgs.brightnessctl
|
||||||
(pkgs.writeScriptBin "lock-suspend" "loginctl lock-session && sleep 0.5 && systemctl suspend-then-hibernate")
|
|
||||||
];
|
];
|
||||||
|
|
||||||
services.hypridle = {
|
services.hypridle = {
|
||||||
|
|
@ -21,6 +20,7 @@
|
||||||
settings = {
|
settings = {
|
||||||
general = {
|
general = {
|
||||||
lock_cmd = "pidof hyprlock || hyprlock";
|
lock_cmd = "pidof hyprlock || hyprlock";
|
||||||
|
before_sleep_cmd = "loginctl lock-session";
|
||||||
after_sleep_cmd = "hyprctl dispatch dpms on";
|
after_sleep_cmd = "hyprctl dispatch dpms on";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -41,7 +41,7 @@
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
timeout = 1800;
|
timeout = 1800;
|
||||||
on-timeout = "lock-suspend";
|
on-timeout = "systemctl suspend${lib.optionalString config.myConfig.hibernation.enable "-then-hibernate"}";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
# 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
|
||||||
|
|
@ -61,9 +62,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
|
||||||
bindrl = SUPER CONTROL, H, exec, systemctl hibernate
|
${lib.optionalString config.myConfig.hibernation.enable "bindrl = SUPER CONTROL, H, exec, systemctl hibernate"}
|
||||||
bindrl = SUPER CONTROL, S, exec, lock-suspend
|
bindrl = SUPER CONTROL, S, exec, $suspend
|
||||||
bindl = , switch:on:Lid Switch, exec, lock-suspend
|
bindl = , switch:on:Lid Switch, exec, $suspend
|
||||||
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
|
||||||
|
|
||||||
|
|
|
||||||
4
modules/home/hibernate.nix
Normal file
4
modules/home/hibernate.nix
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
{ lib, ... }:
|
||||||
|
{
|
||||||
|
options.myConfig.hibernation.enable = lib.mkEnableOption "";
|
||||||
|
}
|
||||||
|
|
@ -1,18 +1,12 @@
|
||||||
{ pkgs, lib, ... }:
|
|
||||||
{
|
{
|
||||||
imports = [ ../home.nix ];
|
imports = [ ../home.nix ];
|
||||||
|
|
||||||
home.stateVersion = "23.11";
|
home.stateVersion = "23.11";
|
||||||
|
|
||||||
myConfig.de.theme = "light";
|
myConfig.de.theme = "light";
|
||||||
|
|
||||||
wayland.windowManager.hyprland.settings.monitor = [
|
wayland.windowManager.hyprland.settings.monitor = [
|
||||||
"eDP-1,1920x1080@60,0x0,1"
|
"eDP-1,1920x1080@60,0x0,1"
|
||||||
",preferred,auto,1,mirror,eDP-1"
|
",preferred,auto,1,mirror,eDP-1"
|
||||||
];
|
];
|
||||||
|
|
||||||
home.packages = [
|
|
||||||
(lib.hiPrio (
|
|
||||||
pkgs.writeScriptBin "lock-suspend" "loginctl lock-session && sleep 0.5 && systemctl suspend"
|
|
||||||
))
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,11 @@
|
||||||
imports = [ ../home.nix ];
|
imports = [ ../home.nix ];
|
||||||
|
|
||||||
home.stateVersion = "23.11";
|
home.stateVersion = "23.11";
|
||||||
myConfig.de.theme = "dark";
|
|
||||||
|
myConfig = {
|
||||||
|
de.theme = "dark";
|
||||||
|
hibernation.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
home.packages = [
|
home.packages = [
|
||||||
pkgs.ffmpeg
|
pkgs.ffmpeg
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue