fix vpn host naming
[distro-setup] / desktop-20-autostart.sh
1 #!/bin/bash -l
2 # Copyright (C) 2016 Ian Kelling
3
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7
8 # http://www.apache.org/licenses/LICENSE-2.0
9
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 # first 2 alternatives showed under ubuntu 14.04, second 2 under arch at 11/2015
17
18 if [[ $1 ]]; then
19 right_monitor_rotation=left
20 else
21 right_monitor_rotation=normal
22 fi
23
24
25 xout="$(xrandr)"
26 xe() { echo "$xout"; }
27 x=$(xe | grep -Ec '^(DisplayPort-[0123]|DVI-0|DP-[1234]|DVI-I-1) connected')
28 if (( x > 2 )); then
29 left=$(xe | sed -rn 's/^(DVI[^ ]+) connected .*/\1/p')
30 dps=( $(xe | sed -rn 's/^(DP-[01234]|DisplayPort-[01234]) connected .*/\1/p') )
31
32 middle=${dps[1]}
33 right=${dps[0]}
34 # on older distros, i needed to swap middle and right.
35
36
37 xrandr --output $left --mode 2560x1600 --pos 0x0 --rotate left \
38 --output $middle --mode 2560x1600 --pos 1600x0 --rotate left \
39 --output $right --mode 2560x1600 --pos 3200x0 --rotate $right_monitor_rotation
40 elif (( x == 2 )); then
41 # 3rd monitor not working atm, so doing this.
42 left=$(xe | sed -rn 's/^(DVI[^ ]+) connected .*/\1/p')
43 middle=$(xe | sed -rn 's/^(DP-[01234]|DisplayPort-[01234]) connected .*/\1/p')
44 xrandr --output $left --mode 2560x1600 --pos 0x0 --rotate left \
45 --output $middle --mode 2560x1600 --pos 1600x0 --rotate left
46
47 fi
48 /a/bin/distro-setup/input-setup m
49 if isarch; then
50 pulseaudio --start
51 fi
52
53 #indicator-kdeconnect
54 date "+%A, %B %d, %r, %S seconds" > /tmp/desktop-20-autostart-log