From 4b37fb8fb3fd502557942f1c2db2bc0b1012cc8f Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Sun, 22 Dec 2024 04:37:44 +0100 Subject: [PATCH] Rewrite the hyprlock (systemd-lock-handler) service --- home/.config/hypr/hypridle.conf | 1 - home/.config/systemd/user/hyprlock.service | 17 +++++++++++++++++ .../user/lock.target.wants/hyprlock.service | 1 + .../systemd-lock-handler-hyprlock.service | 1 - .../user/systemd-lock-handler-hyprlock.service | 15 --------------- 5 files changed, 18 insertions(+), 17 deletions(-) create mode 100644 home/.config/systemd/user/hyprlock.service create mode 120000 home/.config/systemd/user/lock.target.wants/hyprlock.service delete mode 120000 home/.config/systemd/user/lock.target.wants/systemd-lock-handler-hyprlock.service delete mode 100644 home/.config/systemd/user/systemd-lock-handler-hyprlock.service diff --git a/home/.config/hypr/hypridle.conf b/home/.config/hypr/hypridle.conf index 7feb48c..ac2bfbd 100644 --- a/home/.config/hypr/hypridle.conf +++ b/home/.config/hypr/hypridle.conf @@ -1,7 +1,6 @@ general { - unlock-cmd = killall -s SIGUSR1 hyprlock before_sleep_cmd = loginctl lock-session ignore_dbus_inhibit = false ignore_systemd_inhibit = false; diff --git a/home/.config/systemd/user/hyprlock.service b/home/.config/systemd/user/hyprlock.service new file mode 100644 index 0000000..7e408c9 --- /dev/null +++ b/home/.config/systemd/user/hyprlock.service @@ -0,0 +1,17 @@ +[Unit] +Description=Run hyprlock screenlocker on lock dbus event (using systemd-lock-handler) +Requisite=wm-ready.target +# if hyprlock exists cleanly, enter a 'unlock' target +OnSuccess=unlock.target +# When lock.target is stopped, stop this unit too +PartOf=lock.target + +[Service] +ExecStart=/usr/bin/hyprlock +StandardOutput=journal +ExecStop=/bin/kill -s SIGUSR1 $MAINPID +ExecStopPost=/bin/loginctl unlock-session +Restart=on-failure + +[Install] +WantedBy=lock.target diff --git a/home/.config/systemd/user/lock.target.wants/hyprlock.service b/home/.config/systemd/user/lock.target.wants/hyprlock.service new file mode 120000 index 0000000..6db6455 --- /dev/null +++ b/home/.config/systemd/user/lock.target.wants/hyprlock.service @@ -0,0 +1 @@ +/home/itsdrike/.config/systemd/user/hyprlock.service \ No newline at end of file diff --git a/home/.config/systemd/user/lock.target.wants/systemd-lock-handler-hyprlock.service b/home/.config/systemd/user/lock.target.wants/systemd-lock-handler-hyprlock.service deleted file mode 120000 index 1e92b30..0000000 --- a/home/.config/systemd/user/lock.target.wants/systemd-lock-handler-hyprlock.service +++ /dev/null @@ -1 +0,0 @@ -/home/itsdrike/.config/systemd/user/systemd-lock-handler-hyprlock.service \ No newline at end of file diff --git a/home/.config/systemd/user/systemd-lock-handler-hyprlock.service b/home/.config/systemd/user/systemd-lock-handler-hyprlock.service deleted file mode 100644 index 9cf81e7..0000000 --- a/home/.config/systemd/user/systemd-lock-handler-hyprlock.service +++ /dev/null @@ -1,15 +0,0 @@ -[Unit] -Description=Run hyprlock screenlocker on lock dbus event (using systemd-lock-handler) -# if swaylock exists cleanly, unlock this session -OnSuccess=unlock.target -# When lock.target is stopped, stop this too -PartOf=lock.target -# Delay lock.target until this service is ready -After=lock.target - -[Service] -ExecStart=/usr/bin/stdbuf -oL /usr/bin/hyprlock -Restart=on-failure - -[Install] -WantedBy=lock.target