Skip to content

Instantly share code, notes, and snippets.

@ryukinix
Last active March 24, 2023 13:46
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save ryukinix/bd0c1ddcbbafdb4149ae70e41b7c822b to your computer and use it in GitHub Desktop.
How lock your system before suspend with openrc init via elogind using slock
#!/bin/sh
#
# /lib/elogind/system-sleep/lock.sh
# Lock before suspend integration with elogind
username=lerax
userhome=/home/$username
export XAUTHORITY="$userhome/.Xauthority"
export DISPLAY=":0.0"
case "${1}" in
pre)
su $username -c "/usr/bin/slock" &
sleep 1s;
;;
esac
@piroot01
Copy link

Thak you very much, that is what I was looking for.

@vbedesu
Copy link

vbedesu commented Mar 24, 2023

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment