Created
October 14, 2015 21:06
-
-
Save Ferdi265/395448f598b6cf4adc30 to your computer and use it in GitHub Desktop.
xautolock control wrapper script
This file contains 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/bash | |
xlenable() { | |
echo enabled > /tmp/xlmode-$DISPLAY | |
[[ "$1" != "-quiet" ]] && notify-send "xautolock" "Automatic locking enabled" | |
xautolock -enable | |
} | |
xldisable() { | |
echo disabled > /tmp/xlmode-$DISPLAY | |
[[ "$1" != "-quiet" ]] && notify-send "xautolock" "Automatic locking disabled" | |
xautolock -disable | |
} | |
xltoggle() { | |
[[ $(cat /tmp/xlmode-$DISPLAY) = enabled ]] && xldisable $1 || xlenable $1 | |
} | |
case $1 in | |
now) xlenable -quiet; exec xautolock -locknow;; | |
enable) xlenable $2;; | |
disable) xldisable $2;; | |
toggle) xltoggle $2;; | |
*) echo $0: No such option | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment