aboutsummaryrefslogtreecommitdiff
path: root/xres
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2017-01-10 13:35:57 -0200
committerSilvio Rhatto <rhatto@riseup.net>2017-01-10 13:35:57 -0200
commit3a8f0e063562be65aa79c88e81555cd9b8468367 (patch)
treea228e8e9c7b3ead3eabd1b261dce341321989544 /xres
parent4adfd3172bbee6bbcad3a2bc19f3951bb7feaca2 (diff)
downloadutils-x11-3a8f0e063562be65aa79c88e81555cd9b8468367.tar.gz
utils-x11-3a8f0e063562be65aa79c88e81555cd9b8468367.tar.bz2
Updates xres
Diffstat (limited to 'xres')
-rwxr-xr-xxres10
1 files changed, 7 insertions, 3 deletions
diff --git a/xres b/xres
index 200753d..d2b22c3 100755
--- a/xres
+++ b/xres
@@ -21,11 +21,15 @@ elif ! which xrandr &> /dev/null; then
fi
# Get modeline and interface
-MODELINE="`cvt $X $Y | grep -v '^#'` | sed -e 's/^Modeline //'"
+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'`"
+NAME="`echo $MODELINE | cut -d ' ' -f 1 | sed -e 's/"//g'`"
+
+# Add modeline
+if ! xrandr | grep -q $NAME; then
+ xrandr --newmode $MODELINE
+fi
# Apply
-xrandr --newmode $MODELINE
xrandr --addmode $INTERFACE $NAME
xrandr --output $INTERFACE --mode $NAME