Skip to content

Instantly share code, notes, and snippets.

@logarytm
Created October 23, 2014 18:39
Show Gist options
  • Select an option

  • Save logarytm/b616382d24d533f60a1c to your computer and use it in GitHub Desktop.

Select an option

Save logarytm/b616382d24d533f60a1c to your computer and use it in GitHub Desktop.
Monitor state script in X11
#!/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