Skip to content

Instantly share code, notes, and snippets.

@nicovillanueva
Last active August 29, 2015 14:02
Show Gist options
  • Save nicovillanueva/09e8f16fe63dde1aa5a6 to your computer and use it in GitHub Desktop.
Save nicovillanueva/09e8f16fe63dde1aa5a6 to your computer and use it in GitHub Desktop.
#!/bin/bash
# WARNING: Running as "sh changer.sh" breaks some syntax mumbojumbo
# Just do a "chmod +x changer.sh" and run the file directly.
function show_banner {
figlet -f slant "Super monitor activator"
echo "Choose your destiny:"
}
function show_options {
echo "1. Activar monitor notebook"
echo "2. Prender la tevé"
echo "3. Desactivar monitor de notebook"
echo "'Q'. Quit"
printf "What's it gonna be? "
read opt
}
function do_magic {
case "$1" in
1)
echo "Activating LVDS1"
xrandr --output LVDS1 --mode "1366x768" --right-of HDMI1
;;
2)
echo "Creating mode..."
xrandr --newmode "1920x1080R" 138.50 1920 1968 2000 2080 1080 1083 1088 1111 +hsync -vsync
echo "Adding mode..."
xrandr --addmode HDMI1 "1920x1080R"
echo "Setting mode and activating HDMI1"
xrandr --output HDMI1 --primary --mode "1920x1080R" --left-of LVDS1
;;
3)
echo "Deactivating LVDS1"
xrandr --output LVDS1 --off
;;
'q' | 'Q')
echo "Quitting."
echo
exit 0
;;
*)
printf "NO DUDE.\n1, 2, OR 3. OR 'Q' IF YOU ARE A QUITTER.\nFAGGET.\n"
esac
}
show_banner # Only show banner when starting up
while [[ 1 == 1 ]]; do # :D
show_options
do_magic $opt
echo
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment