-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathxplugrc
executable file
·48 lines (42 loc) · 1.11 KB
/
xplugrc
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
#!/bin/sh
# If not DOCK'ed output or LAPTOP, then it's likely VGA or Display Port
# used for presenation. We assume the primary desktop screen (HDMI3) is
# placed left of the internal laptop screen, while during presentations
# the projector is on our right and the laptop screen is the primary.
LAPTOP=LVDS1
if [ `hostname` = "carbon" ]; then
DOCK=DVI-I-1
DESKPOS=--right-of
PRESPOS=--left-of
else
DOCK=HDMI3
DESKPOS=--left-of
PRESPOS=--right-of
fi
TYPE=$1
DEVICE=$2
STATUS=$3
shift 3
DESC=$*
if [ "$TYPE" != "display" ]; then
case "$TYPE,$STATUS,$DESC" in
pointer,connected,"SynPS/2 Synaptics TouchPad")
xinput set-prop $DEVICE 'Synaptics Off' 1
;;
keyboard,connected,*)
setxkbmap -option ctrl:nocaps
;;
esac
exit 0
fi
if [ "$STATUS" = "disconnected" ]; then
xrandr --output $DEVICE --off
exit 0
fi
if [ "$DEVICE" = "${DOCK}" ]; then
xrandr --output $DEVICE --auto --primary ${DESKPOS} ${LAPTOP}
elif [ "$DEVICE" != "${LAPTOP}" ]; then
xrandr --output $DEVICE --auto ${PRESPOS} ${LAPTOP} --primary
else
xrandr --auto
fi