From: Don Armstrong Date: Wed, 16 Jul 2014 00:56:52 +0000 (-0700) Subject: add rotate monitor X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=ea978f4876c94f47c50f905074bd1a1a278ab2e3;p=bin.git add rotate monitor --- diff --git a/rotate_monitor b/rotate_monitor new file mode 100755 index 0000000..5df04f5 --- /dev/null +++ b/rotate_monitor @@ -0,0 +1,25 @@ +#!/bin/sh + +# rotate all of the attached displays + +XRANDR_OUTPUT=$(xrandr -q) + +OUTPUTS=$(echo "$XRANDR_OUTPUT" |awk '/ connected /{print $1}') + +set -x + +for output in $OUTPUTS; do + NEW_ORIENTATION="left" + # figure out current orientation + ORIENTATION=$(echo "$XRANDR_OUTPUT"|grep "^$output "|awk '{print $4}') + if [ "x$ORIENTATION" = "xleft" ]; then + NEW_ORIENTATION="inverted"; + elif [ "x$ORIENTATION" = "xinverted" ]; then + NEW_ORIENTATION="right"; + elif [ "x$ORIENTATION" = "xright" ]; then + NEW_ORIENTATION="normal"; + else + NEW_ORIENTATION="left"; + fi; + xrandr --output $OUTPUTS --rotate $NEW_ORIENTATION; +done;