hypridle: switch to systemd-lock-handler for lockscreen
Signed-off-by: Myned <dev@bjork.tech>
This commit is contained in:
parent
16c480c8f6
commit
0ec4890572
2 changed files with 27 additions and 39 deletions
|
@ -36,6 +36,7 @@ in {
|
|||
rounding = mkOption {default = 15;};
|
||||
|
||||
### Misc
|
||||
lockscreen = mkOption {default = "hyprlock";};
|
||||
wallpaper = mkOption {default = false;};
|
||||
|
||||
browser = {
|
||||
|
|
|
@ -7,16 +7,25 @@
|
|||
with lib; let
|
||||
grep = "${pkgs.gnugrep}/bin/grep";
|
||||
hyprctl = "${config.programs.hyprland.package}/bin/hyprctl";
|
||||
hyprlock = "${config.home-manager.users.${config.custom.username}.programs.hyprlock.package}/bin/hyprlock";
|
||||
loginctl = "${pkgs.systemd}/bin/loginctl";
|
||||
niri = "${config.programs.niri.package}/bin/niri";
|
||||
pgrep = "${pkgs.procps}/bin/pgrep";
|
||||
pw-cli = "${pkgs.pipewire}/bin/pw-cli";
|
||||
systemctl = "${pkgs.systemd}/bin/systemctl";
|
||||
|
||||
cfg = config.custom.services.hypridle;
|
||||
in {
|
||||
options.custom.services.hypridle.enable = mkOption {default = false;};
|
||||
options.custom.services.hypridle = {
|
||||
enable = mkOption {default = false;};
|
||||
|
||||
dpms = mkOption {
|
||||
default =
|
||||
if config.custom.desktop == "hyprland"
|
||||
then "${hyprctl} dispatch dpms off"
|
||||
else if config.custom.desktop == "niri"
|
||||
then "${niri} msg action power-off-monitors"
|
||||
else "";
|
||||
};
|
||||
};
|
||||
|
||||
config.home-manager.users.${config.custom.username} = mkIf cfg.enable {
|
||||
# https://github.com/hyprwm/hypridle
|
||||
|
@ -24,36 +33,15 @@ in {
|
|||
services.hypridle = {
|
||||
enable = true;
|
||||
|
||||
settings = let
|
||||
# Workaround for red background immediately showing while lockscreen starts
|
||||
# https://github.com/YaLTeR/niri/issues/808
|
||||
do-screen-transition = "${niri} msg action do-screen-transition --delay-ms 1000 &&";
|
||||
in {
|
||||
general = let
|
||||
lock = "${pgrep} hyprlock || ${
|
||||
if config.custom.desktops.desktop == "niri"
|
||||
then do-screen-transition
|
||||
else ""
|
||||
} ${hyprlock}";
|
||||
in {
|
||||
before_sleep_cmd = "${lock} --immediate";
|
||||
lock_cmd = lock;
|
||||
};
|
||||
|
||||
listener = [
|
||||
settings.listener = [
|
||||
{
|
||||
timeout = 15 * 60; # Seconds
|
||||
on-timeout = "${loginctl} lock-session";
|
||||
on-timeout = cfg.dpms;
|
||||
}
|
||||
|
||||
{
|
||||
timeout = 20 * 60; # Seconds
|
||||
on-timeout =
|
||||
if config.custom.desktops.desktop == "hyprland"
|
||||
then "${hyprctl} dispatch dpms off"
|
||||
else if config.custom.desktops.desktop == "niri"
|
||||
then "${niri} msg action power-off-monitors"
|
||||
else "";
|
||||
on-timeout = "${loginctl} lock-session";
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -62,7 +50,6 @@ in {
|
|||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
# BUG: graphical-session-pre.target may not have WAYLAND_DISPLAY set, so service is skipped
|
||||
# https://github.com/nix-community/home-manager/issues/5899
|
||||
|
|
Loading…
Add table
Reference in a new issue