]> git.donarmstrong.com Git - bin.git/blob - rotate_monitor
add reset usb bus command
[bin.git] / rotate_monitor
1 #!/bin/sh
2
3 # rotate all of the attached displays
4
5 XRANDR_OUTPUT=$(xrandr -q)
6
7 OUTPUTS=$(echo "$XRANDR_OUTPUT" |awk '/ connected /{print $1}')
8
9 set -x
10
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";
21     else
22         NEW_ORIENTATION="left";
23     fi;
24     xrandr --output $OUTPUTS --rotate $NEW_ORIENTATION;
25 done;