-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinputselect.sh
executable file
·47 lines (44 loc) · 1.27 KB
/
inputselect.sh
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/bash
DELL_U2515H_1='dev:/dev/i2c-7'
DELL_U2515H_2='dev:/dev/i2c-8'
INPUT_SOURCE_CONTROL='0x60'
INPUT_SOURCE_DP=15
INPUT_SOURCE_mDP=16
INPUT_SOURCE_HDMI_1=17
INPUT_SOURCE_HDMI_2=18
ALL_MON="TRUE"
while [ $# -gt 0 ]
do
key="$1"
case $key in
-t| --toggle)
TOGGLE=1
shift;;
-l| --left)
MONITOR=$DELL_U2515H_2
ALL_MON="FALSE"
shift;;
-r| --right)
MONITOR=$DELL_U2515H_1
ALL_MON="FALSE"
shift;;
-mdp| --mini-displayport| -linux)
INPUT_SOURCE=$INPUT_SOURCE_mDP;;
-dp| --displayport| -mac)
INPUT_SOURCE=$INPUT_SOURCE_DP;;
-hdmi1| --hdmi-1)
INPUT_SOURCE=$INPUT_SOURCE_HDMI_1;;
-hdmi2| --hdmi-2| -win)
INPUT_SOURCE=$INPUT_SOURCE_HDMI_2;;
esac
shift
done
if [[ "$ALL_MON" == 'TRUE' && ! -z $INPUT_SOURCE ]]; then
echo "Changing iputsource for all monitors"
ddccontrol -r $INPUT_SOURCE_CONTROL -w $INPUT_SOURCE $DELL_U2515H_1 >> /dev/null
ddccontrol -r $INPUT_SOURCE_CONTROL -w $INPUT_SOURCE $DELL_U2515H_2 >> /dev/null
elif [[ ! -z $INPUT_SOURCE ]]; then
ddccontrol -r $INPUT_SOURCE_CONTROL -w $INPUT_SOURCE $MONITOR >> /dev/null
else
echo "options: [-l --left | -r --right] input [-mdp|-dp|-hdmi1|hdmi2]"
fi