-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdock.sh
executable file
·52 lines (40 loc) · 1.01 KB
/
dock.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
48
49
50
51
52
switch="on"
[[ $1 == "off" ]] && switch="off"
# find touchpad
# wiki.archlinux.org
declare -i ID
ID=`xinput list | grep -Eo 'ouchPad\s*id\=[0-9]{1,2}' | grep -Eo '[0-9]{1,2}'`
if [[ $switch == "on" ]]
then
# configure additional screen
xrandr --output HDMI1 --auto --output LVDS1 --off
# turn off usb autosuspend
for f in /sys/bus/usb/drivers/usb/*/power/autosuspend
do
sudo su -c "echo '-1' > $f"
done
# turn off screen blanking
xset -dpms
# turn on ethernet
sudo ip link set wlan0 down
sudo netctl start ethernet
# turn off touchpad
xinput disable $ID
# announce completion
notify-send 'Using docked configuration'
else
# configure laptop screen
xrandr --output HDMI1 --off --output LVDS1 --auto
# turn on usb autosuspend
for f in /sys/bus/usb/drivers/usb/*/power/autosuspend
do
sudo su -c "echo 2 > $f"
done
# turn on screen blanking
xset dpms 0 0 300
# turn on touchpad
xinput enable $ID
# announce completion
notify-send 'Using mobile configuration'
fi
eval "$(</home/luki/.fehbg)"