Created
October 23, 2014 18:39
-
-
Save logarytm/b616382d24d533f60a1c to your computer and use it in GitHub Desktop.
Monitor state script in X11
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 | |
| status() | |
| { | |
| xset -q | grep 'Monitor is ' | awk '{print $3}' | |
| } | |
| on() | |
| { | |
| xset dpms force on | |
| } | |
| off() | |
| { | |
| xset dpms force off | |
| } | |
| toggle() | |
| { | |
| if [ "$(status)" == 'On' ]; then | |
| off | |
| else | |
| on | |
| fi | |
| } | |
| case $1 in | |
| status) status ;; | |
| on) on ;; | |
| off) off ;; | |
| *) toggle | |
| esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment