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
|
#!/bin/sh
set -e
LIGHTTHEME="papertheme"
DARKTHEME="campbell"
VIMCONF="${XDG_CONFIG_HOME}/nvim/lua/basic.lua"
ALACRITTYCONF="${XDG_CONFIG_HOME}/alacritty/alacritty.yml"
TMUXCONF="${XDG_CONFIG_HOME}/tmux/tmux.conf"
export $(tmux show-env | grep THEME)
send_vim_cmd() {
vims=$(tmux list-panes -a -F '#{pane_id} #{pane_current_command}' |
grep vim |
cut -d ' ' -f 1)
for pane in $vims; do
#echo "Sending command to '$pane' '$1'"
tmux send-keys -t "$pane" ESCAPE "$1" ENTER
done
}
if [ "$THEME" = "dark" ]; then
# Update alacritty
sed -i "s/${DARKTHEME}/${LIGHTTHEME}/" "${ALACRITTYCONF}"
# Update tmux (Consider making a theme switch in the m4 config and re-running that instead of having it configured here)
tmux set-environment THEME "light"
tmux set -g status-bg "#F2EEDE"
tmux set -g status-fg colour15
tmux setw -g window-status-current-style "bg=colour0,fg=colour255"
tmux setw -g window-status-style "bg=colour7,fg=colour0"
tmux setw -g window-status-bell-style "bg=colour23,fg=colour255"
tmux setw -g window-status-activity-style "bg=colour243,fg=colour255"
tmux set -g status-left "#[fg=colour232,bg=colour3,bold]#{?client_prefix,C-a,}#[default] #[fg=colour0,bg=colour7,bold][#S]#[default] "
tmux set -g status-right "#[fg=colour0,bg=colour7,bold] #(hostname) #[default] #[fg=colour0,bg=colour7,bold] %d/%m/%y #[default] #[fg=colour0,bg=colour7,bold] %H:%M:%S #[default] #[bg=colour7,fg=colour0,bold] #(cat /sys/class/power_supply/BAT0/capacity)% #[default] "
# Update nvim
send_vim_cmd ":set background=light"
send_vim_cmd ":lua vim.api.nvim_set_hl(0, 'ColorColumn', { ctermbg = 'lightgrey', bg = '#eae7da' })"
sed -i 's/"dark"/"light"/' "${VIMCONF}"
sed -i 's/{ ctermbg = "lightgrey", bg = "#363636" }/{ ctermbg = "lightgrey", bg = "#eae7da" }/' "${VIMCONF}"
else
# Update alacritty
sed -i "s/${LIGHTTHEME}/${DARKTHEME}/" "${ALACRITTYCONF}"
# Update tmux
tmux set-environment THEME "dark"
tmux set -g status-bg "#0c0c0c"
tmux set -g status-fg "#d6d6d6"
tmux setw -g window-status-style "bg=colour235,fg=colour7"
tmux setw -g window-status-current-style "bg=colour237,fg=colour7"
tmux setw -g window-status-bell-style "bg=colour23,fg=colour15"
tmux setw -g window-status-activity-style "bg=colour239,fg=colour15"
tmux set -g status-left "#[fg=colour232,bg=colour3,bold]#{?client_prefix,C-a,}#[default] #[fg=colour7,bg=colour235,bold][#S]#[default] "
tmux set -g status-right "#[fg=colour7,bg=colour235,bold] #(hostname) #[default] #[fg=colour7,bg=colour235,bold] %d/%m/%y #[default] #[fg=colour7,bg=colour235,bold] %H:%M:%S #[default] #[bg=colour235,fg=colour7,bold] #(cat /sys/class/power_supply/BAT0/capacity)% #[default] "
sed -i 's/"dark"/"light"/' "${VIMCONF}"
# Update nvim
send_vim_cmd ":set background=dark"
send_vim_cmd ":lua vim.api.nvim_set_hl(0, 'ColorColumn', { ctermbg = 'lightgrey', bg = '#363636' })"
sed -i 's/"light"/"dark"/' "${VIMCONF}"
sed -i 's/{ ctermbg = "lightgrey", bg = "#eae7da" }/{ ctermbg = "lightgrey", bg = "#363636" }/' "${VIMCONF}"
fi
|