diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2024-05-09 19:38:01 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2024-05-09 19:38:01 -0300 |
commit | e896b6cb29fbb7377fefc8cd4fc6b0d72bfd6ccc (patch) | |
tree | 09b0d70a5dad1fdd46de470e4f1685c41a1068cb /xres | |
parent | c12b74d3bb7ae3ffc691ba797467ce5932e6b910 (diff) | |
download | utils-x11-master.tar.gz utils-x11-master.tar.bz2 |
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 |