-
Notifications
You must be signed in to change notification settings - Fork 0
/
env_mgmt.sh
executable file
·67 lines (60 loc) · 1.8 KB
/
env_mgmt.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
system_info () {
DOTS=~/.config # as default to be overridden
if [[ "$(uname -s)" == "Darwin" ]]; then
OS="mac"
elif [[ "$(uname -s)" == "Linux" ]]; then
OS="linux"
device=$(tr -d '\0' < /sys/firmware/devicetree/base/model)
if [[ $device =~ "Raspberry Pi" ]]; then
DOTS=~/Repos/dotfiles
fi
else
echo "Are you lost?"
exit 1
fi
NVIM_C=$DOTS/nvim/lua/config
}
dark_mode () {
ln -nfs $DOTS/alacritty/themes/onedark.toml $DOTS/alacritty/themes/active.toml
ln -nfs $DOTS/tmux/themes/onedark.conf $DOTS/tmux/themes/active.conf
ln -nfs $NVIM_C/themes/dark.lua $NVIM_C/active_colors.lua
# note that zellij will only pick up for new sessions
ln -nfs $DOTS/zellij/config-dark.kdl $DOTS/zellij/config.kdl
update_tmux
}
light_mode () {
ln -nfs $DOTS/alacritty/themes/onedark-light.toml $DOTS/alacritty/themes/active.toml
ln -nfs $DOTS/tmux/themes/solarized-flat.conf $DOTS/tmux/themes/active.conf
ln -nfs $NVIM_C/themes/light.lua $NVIM_C/active_colors.lua
# note that zellij will only pick up for new sessions
ln -nfs $DOTS/zellij/config-light.kdl $DOTS/zellij/config.kdl
update_tmux
}
update_tmux () {
if [ -n "$TMUX" ]; then
tmux source-file $DOTS/tmux/tmux.conf
fi
}
# main loop
system_info
if [ $# -eq 0 ]; then
# automagic for macs if no args
if [[ "$OS" == "mac" ]]; then
val=$(defaults read -g AppleInterfaceStyle 2>/dev/null)
if [[ $val == "Dark" ]]; then
dark_mode
else
light_mode
fi
else
echo "Can't determine system appearance; please provide manually"
fi
elif [ "$1" == "dark" ]; then
dark_mode
elif [ "$1" == "light" ]; then
light_mode
else
echo "Invalid argument; please choose 'light' or 'dark'"
exit 1
fi