diff options
Diffstat (limited to 'xres')
-rwxr-xr-x | xres | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -7,10 +7,11 @@ BASENAME="`basename $0`" X="$1" Y="$2" +INTERFACE="$3" # Check if [ -z "$Y" ]; then - echo "usage: $BASENAME <x-res> <y-res>" + echo "usage: $BASENAME <x-res> <y-res> <interface>" exit 1 elif ! which cvt &> /dev/null; then echo "please install cvt from xserver-xorg-core" @@ -22,9 +23,13 @@ fi # Get modeline and interface MODELINE="`cvt $X $Y | grep -v '^#' | sed -e 's/^Modeline //'`" -INTERFACE="`xrandr | grep " connected" | cut -d ' ' -f 1 | head`" NAME="`echo $MODELINE | cut -d ' ' -f 1 | sed -e 's/"//g'`" +# Fallback to the first connected interface found +if [ -z "$INTERFACE" ]; then + INTERFACE="`xrandr | grep " connected" | cut -d ' ' -f 1 | head -1`" +fi + # Apply xrandr --newmode $MODELINE &> /dev/null xrandr --addmode $INTERFACE $NAME |