X: Add xrandr scripts
[shutils.git] / X / xrandr-exttoright
diff --git a/X/xrandr-exttoright b/X/xrandr-exttoright
new file mode 100755 (executable)
index 0000000..fca0aa6
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+set -e
+
+MAIN=$(xrandr | grep eDP | cut -f1 -d" ")
+if [ "${MAIN}" = "" ]; then
+       echo "Could not find main display."
+       exit 1
+fi
+
+OTHER=$(xrandr | grep "\<connected\>" | grep -v eDP | cut -f1 -d" ")
+if [ "${OTHER}" = "" ]; then
+       echo "Could not find external display."
+       exit 1
+fi
+
+echo "Bring ${OTHER} right of ${MAIN}"
+
+xrandr --output ${MAIN} --auto --primary; xrandr --output ${OTHER} --auto; xrandr --output ${OTHER} --auto --right-of ${MAIN}