Created
September 3, 2018 07:24
-
-
Save dimitris-k/515b1c28edaf5ccacc02a43de74ebfdd to your computer and use it in GitHub Desktop.
Custom /usr/bin/xflock4 to use only slock and check for user activity before actually locking the display
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
PATH=/bin:/usr/bin | |
export PATH | |
sleep 1 | |
xset dpms force off | |
sleep 20 | |
# Check if the monitor is On after these 20 seconds, | |
# which means that the user acted to cancel locking | |
(xset q | grep 'Monitor is On' >/dev/null 2>&1) && exit | |
set -- slock | |
if command -v -- $1 >/dev/null 2>&1; then | |
slock >/dev/null 2>&1 & | |
# turn off display backlight: | |
xset dpms force off | |
exit | |
fi | |
# else access locking failed | |
exit 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment