From 1f8bebd13b6db7988e1d4d0679902a2ceee541e9 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Sun, 20 Nov 2022 02:48:19 +0100 Subject: [PATCH] Move to systemd-lock-handler instead of swayidle for locking Swayidle will likely end up dropping logind support, and they themselves describe it as unstable. For this reason, move to the suggested alternative: systemd-lock-handler, and just have swayidle run the command to trigger the logind session lock event, picked up by systemd-lock-handler. See for reference. --- home/.config/swayidle/config | 2 -- .../systemd-lock-handler.service | 1 + .../systemd-lock-handler-swaylock.service | 1 + .../user/systemd-lock-handler-swaylock.service | 18 ++++++++++++++++++ 4 files changed, 20 insertions(+), 2 deletions(-) create mode 120000 home/.config/systemd/user/default.target.wants/systemd-lock-handler.service create mode 120000 home/.config/systemd/user/lock.target.wants/systemd-lock-handler-swaylock.service create mode 100644 home/.config/systemd/user/systemd-lock-handler-swaylock.service diff --git a/home/.config/swayidle/config b/home/.config/swayidle/config index 86f9c24..ab5ecc7 100644 --- a/home/.config/swayidle/config +++ b/home/.config/swayidle/config @@ -1,4 +1,2 @@ timeout 300 "hyprctl dispatch dpms off && dunstctl set-paused true" resume "hyprctl dispatch dpms on && dunstctl set-paused false" timeout 310 "loginctl lock-session" -before-sleep swaylock -fF -lock swaylock -fF diff --git a/home/.config/systemd/user/default.target.wants/systemd-lock-handler.service b/home/.config/systemd/user/default.target.wants/systemd-lock-handler.service new file mode 120000 index 0000000..b7c9720 --- /dev/null +++ b/home/.config/systemd/user/default.target.wants/systemd-lock-handler.service @@ -0,0 +1 @@ +/usr/lib/systemd/user/systemd-lock-handler.service \ No newline at end of file diff --git a/home/.config/systemd/user/lock.target.wants/systemd-lock-handler-swaylock.service b/home/.config/systemd/user/lock.target.wants/systemd-lock-handler-swaylock.service new file mode 120000 index 0000000..587607f --- /dev/null +++ b/home/.config/systemd/user/lock.target.wants/systemd-lock-handler-swaylock.service @@ -0,0 +1 @@ +/home/itsdrike/.config/systemd/user/systemd-lock-handler-swaylock.service \ No newline at end of file diff --git a/home/.config/systemd/user/systemd-lock-handler-swaylock.service b/home/.config/systemd/user/systemd-lock-handler-swaylock.service new file mode 100644 index 0000000..c5a2196 --- /dev/null +++ b/home/.config/systemd/user/systemd-lock-handler-swaylock.service @@ -0,0 +1,18 @@ +[Unit] +Description=Run Swaylock 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] +# systemd will consider this service started when swaylock forks +# which swaylock will only do after it has locked the screen +Type=forking +ExecStart=/usr/bin/swaylock -fF +Restart=on-failure + +[Install] +WantedBy=lock.target