-
Notifications
You must be signed in to change notification settings - Fork 0
/
projector
executable file
·59 lines (46 loc) · 1.09 KB
/
projector
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
#!/usr/bin/env bash
usage() {
cat <<EOF
USAGE:
$0 [-p POSITION] -d NAME
DESCRIPTION:
Turn on display called NAME at position POSITION
POSITIONS
> RIGHT: default
LEFT
ABOVE
BELOW
EOF
}
set -x
################################################################
declare -r LAPTOP=LVDS1
declare POSITION=RIGHT;
declare PROJECTOR;
declare XRANDR_POSITION;
################################################################
while getopts "p:d:h" opt; do
case $opt in
p)
POSITION=${OPTARG}
;;
d)
PROJECTOR=${OPTARG}
;;
*)
usage
exit 1
;;
esac
done
case $POSITION in
LEFT) XRANDR_POSITION=--left-of;;
RIGHT) XRANDR_POSITION=--right-of;;
ABOVE) XRANDR_POSITION=--above;;
BELOW) XRANDR_POSITION=--below;;
*) usage; exit 2;;
esac
################################################################
test -z $PROJECTOR && usage && exit 3
################################################################
xrandr --output $PROJECTOR --auto $XRANDR_POSITION $LAPTOP