From 33dde7d858d2b1f11d1e3ac1c0975d206ae78f2e Mon Sep 17 00:00:00 2001 From: Justin Oros Date: Wed, 15 Apr 2020 13:13:27 -0700 Subject: [PATCH] Revised script to accommodate more than 1 screen Script now rotates up to 4 screens at a time by default --- rotate.sh | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/rotate.sh b/rotate.sh index 4441a9f..d8558f5 100644 --- a/rotate.sh +++ b/rotate.sh @@ -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 -do - for myScreenType in $myScreenTypes + export DISPLAY=$display + for screen_rotation in $screen_rotations do - xrandr --output $myScreenType-$myScreenNum --rotate $myScreenRotation > /dev/null 2>&1 - sleep $mySleepTime + printf "Attempting to rotate screens $screen_rotation...\n" + for screen_type in $screen_types + do + + for screen in 0 .. $screens + do + xrandr --output $screen_type-$screen --rotate $screen_rotation > /dev/null 2>&1 + done + done + sleep $sleep_time done -done } rotate