mirror of
https://github.com/theniceboy/.config.git
synced 2025-12-26 14:44:57 +08:00
tmux configurable theme color part 2
This commit is contained in:
parent
87274915bf
commit
08d3e1e8a7
2 changed files with 28 additions and 5 deletions
11
.tmux.conf
11
.tmux.conf
|
|
@ -228,7 +228,7 @@ bind E run-shell "~/.config/tmux/scripts/layout_builder.sh down"
|
|||
|
||||
# -- toggle_syn_input
|
||||
bind C-g if-shell '[[ $(tmux showw synchronize-panes | cut -d\ -f2) == "on" ]]' \
|
||||
'setw synchronize-panes off; set -g pane-border-style fg=magenta' \
|
||||
'setw synchronize-panes off; set -g pane-border-style fg=#{?#{!=:#{environ:TMUX_THEME_COLOR},},#{environ:TMUX_THEME_COLOR},#b294bb}' \
|
||||
'setw synchronize-panes on; set -g pane-border-style fg=red'
|
||||
|
||||
# -- toggle_status
|
||||
|
|
@ -236,10 +236,11 @@ bind C-g if-shell '[[ $(tmux showw synchronize-panes | cut -d\ -f2) == "on" ]]'
|
|||
# -- theme
|
||||
|
||||
# panes
|
||||
run-shell "~/.config/tmux/scripts/update_theme_color.sh"
|
||||
setw -g pane-border-status top
|
||||
set -g pane-active-border-style fg=brightblue
|
||||
set -g pane-active-border-style fg=#b294bb
|
||||
set -g pane-border-style fg=colour244
|
||||
setw -g pane-border-format '#{?pane_active, #[fg=#{?#{!=:#{environ:TMUX_THEME_COLOR},},#{environ:TMUX_THEME_COLOR},#b294bb}]#[bg=#{?#{!=:#{environ:TMUX_THEME_COLOR},},#{environ:TMUX_THEME_COLOR},#b294bb}]#[fg=#1d1f21]#[bold] #{?window_zoomed_flag,⛶ ,} #(~/.config/tmux/scripts/pane_starship_title.sh #{pane_pid} #{pane_width} "#{pane_current_path}" "#{pane_current_command}") #[bg=default]#[fg=#{?#{!=:#{environ:TMUX_THEME_COLOR},},#{environ:TMUX_THEME_COLOR},#b294bb}]#[default], #[fg=colour244]#[bg=colour244]#[fg=#1d1f21] #{?window_zoomed_flag,⛶ ,} #(~/.config/tmux/scripts/pane_starship_title.sh #{pane_pid} #{pane_width} "#{pane_current_path}" "#{pane_current_command}") #[bg=default]#[fg=colour244]#[default] }'
|
||||
setw -g pane-border-format '#{?pane_active, #[fg=#{@theme_color}]#[bg=#{@theme_color}]#[fg=#1d1f21]#[bold] #{?window_zoomed_flag,⛶ ,} #(~/.config/tmux/scripts/pane_starship_title.sh #{pane_pid} #{pane_width} "#{pane_current_path}" "#{pane_current_command}") #[bg=default]#[fg=#{@theme_color}]#[default], #[fg=colour244]#[bg=colour244]#[fg=#1d1f21] #{?window_zoomed_flag,⛶ ,} #(~/.config/tmux/scripts/pane_starship_title.sh #{pane_pid} #{pane_width} "#{pane_current_path}" "#{pane_current_command}") #[bg=default]#[fg=colour244]#[default] }'
|
||||
#set -g pane-active-border-style fg=brightblue
|
||||
#set -g pane-border-style fg=magenta
|
||||
|
||||
|
|
@ -257,8 +258,8 @@ set -g status-bg black
|
|||
#set -g status-left '#[fg=brightyellow] #{?client_prefix,⌨ , } #[fg=magenta,bold] %Y-%m-%d %H:%M '
|
||||
#set -g status-right '#(rainbarf --battery --remaining --bolt --tmux --rgb)'
|
||||
#set -g status-left "#[fg=magenta,bold] %Y-%m-%d %H:%M | #[fg=brightblue]#(curl icanhazip.com) #(ifconfig en0 | grep 'inet ' | awk '{print \"en0 \" $2}') #(ifconfig en1 | grep 'inet ' | awk '{print \"en1 \" $2}') #(ifconfig en3 | grep 'inet ' | awk '{print \"en3 \" $2}') #(ifconfig tun0 | grep 'inet ' | awk '{print \"vpn \" $2}') "
|
||||
setw -g window-status-format '#[fg=brightblue] #W '
|
||||
setw -g window-status-current-format '#[fg=#{?#{!=:#{environ:TMUX_THEME_COLOR},},#{environ:TMUX_THEME_COLOR},#b294bb},bold] #W '
|
||||
setw -g window-status-format '#[fg=#c5c8c6] #W '
|
||||
setw -g window-status-current-format '#[fg=#{@theme_color},bold] #W '
|
||||
setw -g window-status-activity-style bg=black
|
||||
setw -g window-status-bell-style bg=black
|
||||
#set-window-option -g window-status-current-format "#[fg=colour235, bg=colour27]⮀#[fg=colour255, bg=colour27] #I ⮁ #W #[fg=colour27, bg=colour235]⮀"
|
||||
|
|
|
|||
22
tmux/scripts/update_theme_color.sh
Executable file
22
tmux/scripts/update_theme_color.sh
Executable file
|
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Determine theme color from tmux environments with fallback
|
||||
# Prefer session env, then global env, else default.
|
||||
theme_line=$(tmux show-environment TMUX_THEME_COLOR 2>/dev/null || true)
|
||||
if [[ "$theme_line" == TMUX_THEME_COLOR=* ]]; then
|
||||
theme="${theme_line#TMUX_THEME_COLOR=}"
|
||||
else
|
||||
theme_line=$(tmux show-environment -g TMUX_THEME_COLOR 2>/dev/null || true)
|
||||
if [[ "$theme_line" == TMUX_THEME_COLOR=* ]]; then
|
||||
theme="${theme_line#TMUX_THEME_COLOR=}"
|
||||
else
|
||||
theme="#b294bb"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Cache as a user option and apply to border style
|
||||
tmux set -g @theme_color "$theme"
|
||||
tmux set -g pane-active-border-style "fg=$theme"
|
||||
|
||||
exit 0
|
||||
Loading…
Add table
Add a link
Reference in a new issue