3 # rotate all of the attached displays
5 XRANDR_OUTPUT=$(xrandr -q)
7 OUTPUTS=$(echo "$XRANDR_OUTPUT" |awk '/ connected /{print $1}')
11 for output in $OUTPUTS; do
12 NEW_ORIENTATION="left"
13 # figure out current orientation
14 ORIENTATION=$(echo "$XRANDR_OUTPUT"|grep "^$output "|awk '{print $4}')
15 if [ "x$ORIENTATION" = "xleft" ]; then
16 NEW_ORIENTATION="inverted";
17 elif [ "x$ORIENTATION" = "xinverted" ]; then
18 NEW_ORIENTATION="right";
19 elif [ "x$ORIENTATION" = "xright" ]; then
20 NEW_ORIENTATION="normal";
22 NEW_ORIENTATION="left";
24 xrandr --output $OUTPUTS --rotate $NEW_ORIENTATION;