Last active
August 29, 2015 14:16
-
-
Save jmrodri/cad187f6cb5d5ed832a3 to your computer and use it in GitHub Desktop.
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
# Copyright 2013 jesus m. rodriguez | |
#!/bin/sh | |
xres=$1 | |
yres=$2 | |
fullmodeline=$(cvt 1366 768 | grep Modeline | awk '{$1=""; print $0}') | |
modeline=$(echo $fullmodeline | awk '{print $1}') | |
monitors=$(xrandr | grep " connected " | awk '{print $1}') | |
matches=$(echo $monitors | gawk '{print NF}') | |
case "$matches" in | |
0) | |
echo "No matches found" | |
show="" | |
;; | |
1) | |
show=$monitors | |
;; | |
*) | |
echo | |
echo "Multiple matches found..." | |
i=1 | |
for option in $monitors | |
do | |
echo "$i: $option" | |
i=`expr $i + 1` | |
done | |
echo "q: Quit" | |
echo | |
read -p "? " ans | |
if [ "q" == "$ans" ]; then | |
show="" | |
else | |
show=$(echo $monitors | gawk '{print $'$ans'}') | |
fi | |
;; | |
esac | |
if [ "" != "$show" ]; then | |
#xrandr --newmode $fullmodeline | |
xrandr --addmode $show $modeline | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment