2020-02-12 15:52:08 -07:00
|
|
|
#!/bin/bash
|
2023-07-24 13:52:10 -07:00
|
|
|
# Description: Rotate screen clockwise in a complete circle
|
|
|
|
|
# Usage: rotate.sh
|
|
|
|
|
# Author: Justin Oros
|
|
|
|
|
# Source: https://github.com/JustinOros
|
2020-02-12 15:52:08 -07:00
|
|
|
|
2020-04-15 13:13:27 -07:00
|
|
|
screen_types="VGA HDMI DP eDP"
|
|
|
|
|
screen_rotations="right inverted left normal"
|
|
|
|
|
screens=4
|
|
|
|
|
sleep_time=3
|
|
|
|
|
display=:0
|
2020-02-12 15:52:08 -07:00
|
|
|
|
|
|
|
|
rotate() {
|
2020-04-15 13:13:27 -07:00
|
|
|
export DISPLAY=$display
|
|
|
|
|
for screen_rotation in $screen_rotations
|
2020-02-12 15:52:08 -07:00
|
|
|
do
|
2020-04-15 13:13:27 -07:00
|
|
|
printf "Attempting to rotate screens $screen_rotation...\n"
|
|
|
|
|
for screen_type in $screen_types
|
|
|
|
|
do
|
|
|
|
|
for screen in 0 .. $screens
|
|
|
|
|
do
|
2023-07-24 13:52:10 -07:00
|
|
|
xrandr -o $screen_rotation > /dev/null 2>&1
|
2020-04-15 13:13:27 -07:00
|
|
|
done
|
|
|
|
|
done
|
|
|
|
|
sleep $sleep_time
|
2020-02-12 15:52:08 -07:00
|
|
|
done
|
|
|
|
|
}
|
|
|
|
|
rotate
|