Setup seamless, automatic, and persistent colorscheme switching in tmux
that follows colorsync
This commit is contained in:
parent
9c5a1479b7
commit
68b8a7b608
4 changed files with 62 additions and 8 deletions
|
|
@ -1,7 +1,31 @@
|
|||
format_for_tmux() {
|
||||
fg="#1F2430"
|
||||
bg="#73D0FF"
|
||||
THEME=$(colorsync get)
|
||||
|
||||
default() {
|
||||
bg="#95E6CB"
|
||||
fg="#000000"
|
||||
text_col="#BFBDB6"
|
||||
}
|
||||
|
||||
case "$THEME" in
|
||||
ayudark)
|
||||
default
|
||||
;;
|
||||
ayumirage)
|
||||
bg="#95E6CB"
|
||||
fg="#101521"
|
||||
text_col="#CCCAC2"
|
||||
;;
|
||||
ayulight)
|
||||
bg="#4CBF99"
|
||||
fg="#F3F4F5"
|
||||
text_col="#5C6166"
|
||||
;;
|
||||
*)
|
||||
default
|
||||
;;
|
||||
esac
|
||||
|
||||
format_for_tmux() {
|
||||
echo $1 | gawk -v bg="$bg" -v fg="$fg" -v text_col="$text_col" '{printf("#[default]#[fg="bg"]#[default]#[bg="bg", fg="fg", bold]%s #[default]#[fg="bg"]#[default]#[fg="text_col"] %s", substr($0, 1, 1), substr($0, 2))}'
|
||||
}
|
||||
|
||||
|
|
|
|||
28
tmux/tmux-statusbar-color.sh
Executable file
28
tmux/tmux-statusbar-color.sh
Executable file
|
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
THEME=$(colorsync get)
|
||||
|
||||
default() {
|
||||
tmux set-option -g status-bg "#000000"
|
||||
tmux setw -g window-status-format "#[bg=#000000,fg=#BFBDB6] #[bold]#I #[default] #[fg=#59C2FF]#W #[default]"
|
||||
tmux setw -g window-status-current-format "#[bg=#95E6CB,fg=#000000] #[bold]#I #[default] #[fg=#FF8F40]#W #[default]"
|
||||
}
|
||||
|
||||
case "$THEME" in
|
||||
ayudark)
|
||||
default
|
||||
;;
|
||||
ayumirage)
|
||||
tmux set-option -g status-bg "#101521"
|
||||
tmux setw -g window-status-format "#[bg=#101521,fg=#CCCAC2] #[bold]#I #[default] #[fg=#73D0FF]#W #[default]"
|
||||
tmux setw -g window-status-current-format "#[bg=#95E6CB,fg=#101521] #[bold]#I #[default] #[fg=#FFCC66]#W #[default]"
|
||||
;;
|
||||
ayulight)
|
||||
tmux set-option -g status-bg "#F0F0F0"
|
||||
tmux setw -g window-status-format "#[bg=#F0F0F0,fg=#5C6166] #[bold]#I #[default] #[fg=#399EE6]#W #[default]"
|
||||
tmux setw -g window-status-current-format "#[bg=#4CBF99,fg=#F0F0F0] #[bold]#I #[default] #[fg=#FA8D3E]#W #[default]"
|
||||
;;
|
||||
*)
|
||||
default
|
||||
;;
|
||||
esac
|
||||
4
tmux/tmux-watchman-statuscolor-trigger.sh
Executable file
4
tmux/tmux-watchman-statuscolor-trigger.sh
Executable file
|
|
@ -0,0 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
watchman watch-project "$HOME/.local/state/colorsync"
|
||||
watchman -- trigger "$HOME/.local/state/colorsync" tmux_statusbar_color 'current' -- bash "$HOME/.config/tmux/tmux-statusbar-color.sh"
|
||||
|
|
@ -107,7 +107,7 @@ set -g history-limit 50000
|
|||
set -g display-time 2500
|
||||
|
||||
# Refresh 'status-left' and 'status-right' more often, from every 15s to 5s
|
||||
set -g status-interval 2
|
||||
set -g status-interval 5
|
||||
|
||||
# Focus events enabled for terminals that support them
|
||||
set -g focus-events on
|
||||
|
|
@ -121,13 +121,11 @@ setw -g automatic-rename off
|
|||
set-hook -g after-new-window "run-shell '~/.config/tmux/tmux-rename-window.sh | xargs tmux rename-window'"
|
||||
set-hook -g pane-focus-in "run-shell '~/.config/tmux/tmux-rename-window.sh | xargs tmux rename-window'"
|
||||
|
||||
setw -g window-status-format "#[bg=#171B24,fg=#CCCAC2] #[bold]#I #[default] #[fg=#73D0FF]#W #[default]"
|
||||
setw -g window-status-current-format "#[bg=#757B84,fg=#EFEDE7] #[bold]#I #[default] #[fg=#FFAD66]#W #[default]"
|
||||
|
||||
# Set the right status: Battery, date and time, session name
|
||||
set -g status-right "#($HOME/.config/tmux/tmux-status-right.sh)"
|
||||
run-shell '~/.config/tmux/tmux-statusbar-color.sh'
|
||||
run-shell '~/.config/tmux/tmux-watchman-statuscolor.sh'
|
||||
|
||||
set -g status-bg "#171B24"
|
||||
set -g status-style bold
|
||||
|
||||
# SSH agent forwarding
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue