Created
January 15, 2013 20:43
-
-
Save logosity/4541861 to your computer and use it in GitHub Desktop.
toggle screen saver on and off on an xwindows-using linux machine (tested only on Ubuntu)
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/bash | |
case "$1" in | |
on) | |
/usr/bin/xset -display :0.0 dpms force on | |
/usr/bin/xset -display :0.0 -dpms | |
/usr/bin/xset -display :0.0 s off | |
/usr/bin/xset -display :0.0 s reset | |
;; | |
off) | |
/usr/bin/xset -display :0.0 dpms force off | |
/usr/bin/xset -display :0.0 dpms 60 90 120 | |
;; | |
?) | |
echo "Usage: monitors on|off" | |
exit 1 | |
;; | |
*) #toggle | |
if [[ "$(xset -q -display :0.0 | grep -i 'disabled')" == "" ]] | |
then $0 on | |
else $0 off | |
fi | |
esac | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment