-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathorient
More file actions
executable file
·78 lines (62 loc) · 1.85 KB
/
orient
File metadata and controls
executable file
·78 lines (62 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/bash
left_orientation=$1
center_orientation=$2
right_orientation=$3
left_input_name="HDMI-1"
center_input_name="DP-0"
right_input_name="HDMI-0"
get_width_from_orientation() {
if [[ $1 == "left" || $1 == "right" ]]; then
echo 1080
elif [[ $1 == "normal" ]]; then
echo 1920
elif [[ $1 == "off" ]]; then
echo 0
else
echo 0
fi
}
left_x=0
if [[ $(get_width_from_orientation $left_orientation) == 1080 ]]; then
left_y=0
else
left_y=$((1920 - 1080))
fi
if [[ $left_orientation == "off" ]]; then
left_mode="off"
left_orientation="normal"
else
left_mode="auto"
fi
center_x=$(get_width_from_orientation $left_orientation)
if [[ $(get_width_from_orientation $center_orientation) == 1080 ]]; then
center_y=0
else
center_y=$((1920 - 1080))
fi
if [[ $center_orientation == "off" ]]; then
center_mode="off"
center_orientation="normal"
else
center_mode="auto"
fi
right_x=$((center_x + $(get_width_from_orientation $center_orientation)))
if [[ $(get_width_from_orientation $right_orientation) == 1080 ]]; then
# it's vertical
right_y=0
else
right_y=$((1920 - 1080))
fi
if [[ $right_orientation == "off" ]]; then
right_mode="off"
right_orientation="normal"
else
right_mode="auto"
fi
echo "\
xrandr --output HDMI-1 --rotate ${left_orientation} --auto --pos ${left_x}x${left_y} \
--output DP-0 --rotate ${center_orientation} --pos ${center_x}x${center_y} \
--output HDMI-0 --rotate ${right_orientation} --auto --pos ${right_x}x${right_y}"
xrandr --output ${left_input_name} --${left_mode} --rotate ${left_orientation} --pos ${left_x}x${left_y} \
--output ${center_input_name} --${center_mode} --rotate ${center_orientation} --pos ${center_x}x${center_y} \
--output ${right_input_name} --${right_mode} --rotate ${right_orientation} --pos ${right_x}x${right_y}