This repository was archived by the owner on Nov 13, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdock
More file actions
executable file
·76 lines (66 loc) · 1.69 KB
/
dock
File metadata and controls
executable file
·76 lines (66 loc) · 1.69 KB
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
#!/usr/bin/env bash
#
# Dock/undock from my workstation.
#
wlan_interface="wlan0"
eth_profile="general-eth-static"
out_main="eDP1"
out_extra="VGA1"
extra_loc="--right-of"
_BASHPLATE_DIR="$HOME/.local/share/bashplate"
source "$_BASHPLATE_DIR/bashplate.sh"
_LOG_PRE="dock"
_usage="\
Usage: dock [-n] [-u]
undock [-n]
Dock/undock from my workstation.
Options:
-u, --undock undock instead (no effect if filename is undock)
-n, --network change network as well
-v, --verbose be verbose
-h, --help display this help text and exit\
"
while getopts_long :vhnu opt \
verbose 0 \
help 0 \
network 0 \
undock 0 \
"" "$@"
do
case "$opt" in
v|verbose) _VERBOSE=$((_VERBOSE + 1)) ;;
h|help) _print_usage 0 ;;
:) _err "$OPTLERR"; _print_usage 1 ;;
n|network) opt_net=1 ;;
u|undock) opt_undock=1 ;;
esac
done
shift $((OPTLIND-1))
dock_on() {
#xrandr --output $out_extra --auto $extra_loc $out_main --set "Broadcast RGB" "Full"
xrandr --output $out_extra --auto $extra_loc $out_main
if [[ $opt_net ]]; then
sudo systemctl stop netctl-auto@$wlan_interface
sudo netctl restart "$eth_profile"
fi
}
dock_off() {
xrandr --output $out_extra --off
if [[ $opt_net ]]; then
sudo netctl stop "$eth_profile"
sudo systemctl restart netctl-auto@$wlan_interface
fi
}
if [[ "$_FILENAME" == "dock" ]]; then
if [[ $opt_undock ]]; then
dock_off
else
dock_on
fi
elif [[ "$_FILENAME" == "undock" ]]; then
dock_off
else
_err "unknown command" 2
fi
# reset background because it can glitch out
"$HOME"/.assets/backgrounds/set-desktop-background