Revised script to accommodate more than 1 screen

Script now rotates up to 4 screens at a time by default
This commit is contained in:
justin authored and GitHub committed 2020-04-15 13:13:27 -07:00
1 parent 68b3f71a01
commit 33dde7d858
1 file changed
+16 -11
+16 -11
View File
@@ -1,23 +1,28 @@
#!/bin/bash
# rotate screen clockwise in a complete circle once
# rotate all screens clockwise in a complete circle
# by Justin Oros
myScreenTypes="VGA HDMI DP eDP"
myScreenRotations="normal right inverted left normal"
myScreenNum=1
mySleepTime=3
myDisplay=:0
screen_types="VGA HDMI DP eDP"
screen_rotations="right inverted left normal"
screens=4
sleep_time=3
display=:0
rotate() {
export DISPLAY=$myDisplay
for myScreenRotation in $myScreenRotations
export DISPLAY=$display
for screen_rotation in $screen_rotations
do
for myScreenType in $myScreenTypes
printf "Attempting to rotate screens $screen_rotation...\n"
for screen_type in $screen_types
do
xrandr --output $myScreenType-$myScreenNum --rotate $myScreenRotation > /dev/null 2>&1
sleep $mySleepTime
for screen in 0 .. $screens
do
xrandr --output $screen_type-$screen --rotate $screen_rotation > /dev/null 2>&1
done
done
sleep $sleep_time
done
}
rotate