Skip to content

Commit

Permalink
Move to systemd-lock-handler instead of swayidle for locking
Browse files Browse the repository at this point in the history
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 <swaywm/swayidle#117> for reference.
  • Loading branch information
ItsDrike committed Nov 20, 2022
1 parent 89a5b15 commit 1f8bebd
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
2 changes: 0 additions & 2 deletions home/.config/swayidle/config
Original file line number Diff line number Diff line change
@@ -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
18 changes: 18 additions & 0 deletions home/.config/systemd/user/systemd-lock-handler-swaylock.service
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 1f8bebd

Please sign in to comment.