-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathxrandr-fix
executable file
·106 lines (100 loc) · 3.73 KB
/
xrandr-fix
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/bin/sh
mine=LVDS1
mine=eDP
monitorsinoffice=`xrandr |grep -E '1920x1200.*59.95' |wc -l`
if [ "$1" = "office" -o \( $monitorsinoffice -eq 2 \) ]; then
left=`xrandr |grep -E 'DisplayPort.* connected|HDMI-A-0.* connected'|cut -f 1 -d ' ' |tail -1`
right=`xrandr |grep -E 'DisplayPort.* connected|HDMI-A-0.* connected'|cut -f 1 -d ' ' |head -1`
else
left=`xrandr |grep -E 'DisplayPort.* connected|HDMI-A-0.* connected'|cut -f 1 -d ' ' |head -1`
right=`xrandr |grep -E 'DisplayPort.* connected|HDMI-A-0.* connected'|cut -f 1 -d ' ' |tail -1`
fi
echo left: $left right: $right
xrandr --auto
xrandr --output eDP --auto
xrandr --output DP1 --auto
xrandr --output DP2 --auto
xrandr --output DP3 --auto
xrandr --output VGA1 --auto
xrandr --output VGA2 --auto
xrandr --output LVDS1 --auto
xrandr --output HDMI1 --auto
xrandr --output HDMI2 --auto
xrandr --output HDMI3 --auto
xrandr --output LVDS2 --auto
xrandr --output DP-1-2 --auto
xrandr --output $left --auto
xrandr --output $right --auto
xrandr --auto --output VGA1 --left-of $mine
xrandr --auto --output VGA2 --left-of $mine
xrandr --auto --output DP1 --right-of $mine
xrandr --auto --output DP2 --right-of $mine
xrandr --auto --output DP3 --left-of $mine
xrandr --auto --output HDMI1 --right-of $mine
xrandr --auto --output HDMI2 --right-of $mine
xrandr --auto --output HDMI3 --right-of $mine
xrandr --auto --output DP-1-2 --right-of $mine
xrandr --auto --output $left --left-of $mine
xrandr --auto --output $right --right-of $mine
if [ "$1" = "same" ]; then
max=`xrandr |awk '{print $1 }' |sort |uniq -c |grep " 2" |awk '{print $2}' |sort -n |tail -1`
maxxx=1440x900
for m in `xrandr |grep -v $mine |grep ' connected' |awk '{print $1}'`; do
xrandr --output $m --mode $max
xrandr --auto --output $m --same-as $mine
done
elif [ "$1" = "off" ]; then
xrandr --output DP1 --off
xrandr --output VGA1 --off
xfconf-query -c xfce4-panel -p /panels/panel-0/output-name -s monitor-0
fi
xfconf-query -c xfce4-panel -p /panels/panel-0/output-name -s auto
#xfconf-query -c xfce4-panel -p /panels/panel-0/output-name -s LVDS1
xfconf-query -c xfce4-panel -p /panels/panel-0/output-name -s monitor-1
#xrandr --auto --output DP1 --right-of LVDS1 --rotate right
setupeth()
{
LC_ALL=C nmcli d list iface eth0 |grep GENERAL.CONNECTION |grep "not connected"
isup=$?
LC_ALL=C nmcli d list iface eth0 |grep CAPABILITIES.CARRIER-DETECT: |grep "yes"
isconnected=$?
echo isup: $isup isconnected: $isconnected
if [ \( $isup = 0 \) -a \( $isconnected = 0 \) ]; then
nmcli con up uuid ae86f034-c50e-4b44-aad5-5035e1ebed18
sleep 10
sudo /etc/init.d/openvpn restart
fi
}
# 3 monitors
if [ "`xrandr -q |grep " connected" |wc -l`" -eq 3 ] ;then
setupeth
xfconf-query -c xfce4-panel -p /panels/panel-0/output-name -s monitor-1
xdotool search --class pidgin |while read id; do
wmctrl -ir $id -b remove,maximized_vert,maximized_horz
xdotool windowmove $id 0 25
wmctrl -ir $id -b add,maximized_vert,maximized_horz
done
xdotool search --name Terminal |while read id; do
wmctrl -ir $id -b remove,maximized_vert,maximized_horz
#xdotool windowmove $id 1599 25
xdotool windowmove $id 1920 49
wmctrl -ir $id -b add,maximized_vert,maximized_horz
done
xdotool search --name chromium |while read id; do
wmctrl -ir $id -b remove,maximized_vert,maximized_horz
xdotool windowmove $id 3200 25
wmctrl -ir $id -b add,maximized_vert,maximized_horz
done
fi
if [ "`xrandr -q |grep " connected" |wc -l`" -eq 1 ] ;then
#setupeth
xfconf-query -c xfce4-panel -p /panels/panel-0/output-name -s monitor-0
fi
if [ "`xrandr -q |grep " connected" |wc -l`" -eq 2 ] ;then
#setupeth
xfconf-query -c xfce4-panel -p /panels/panel-0/output-name -s monitor-0
fi
if [ "$1" = "off" ]; then
xfconf-query -c xfce4-panel -p /panels/panel-0/output-name -s monitor-0
fi
synclient TouchpadOff=1