From 5e11cd8ead1e8c7e375c6808489e06be1de403f4 Mon Sep 17 00:00:00 2001 From: cry999 <44611895+cry999@users.noreply.github.com> Date: Thu, 2 Jan 2025 12:34:48 +0900 Subject: [PATCH] feat: make window name configurable (#28) * feat: make window fomat configurable * chore: remove local window_name_format * chore: write usage of new config. --- README.md | 5 +++++ scripts/tmux2k.sh | 13 +++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 7bbf535..adefa27 100644 --- a/README.md +++ b/README.md @@ -157,6 +157,11 @@ set -g @tmux2k-time-format "%F %R" # network interface to watch set -g @tmux2k-network-name "wlo1" + +# fully custom window name format. +# see also FORMATS and STYLES sections in tmux(1) +set -g @tmux2k-window-name-format "█ #{window_index} #{window_name}:#{b:pane_current_path}" + ``` #### 🪆 Add New Plugins diff --git a/scripts/tmux2k.sh b/scripts/tmux2k.sh index aec9750..7e65ccd 100755 --- a/scripts/tmux2k.sh +++ b/scripts/tmux2k.sh @@ -7,6 +7,7 @@ source "$current_dir"/utils.sh show_powerline=$(get_tmux_option "@tmux2k-show-powerline" true) window_list_alignment=$(get_tmux_option "@tmux2k-window-list-alignment" 'absolute-centre') +window_name_format=$(get_tmux_option "@tmux2k-window-name-format" '#I:#W') refresh_rate=$(get_tmux_option "@tmux2k-refresh-rate" 60) start_icon=$(get_tmux_option "@tmux2k-start-icon" "session") l_sep=$(get_tmux_option "@tmux2k-left-sep" ) @@ -257,17 +258,17 @@ window_list() { if $show_powerline; then tmux set-window-option -g window-status-current-format \ - "#[fg=${wfg},bg=${wbg}]${wl_sep}#[bg=${wfg}]${current_flags}#[fg=${wbg}]${spacer}#I:#W${spacer}#[fg=${wfg},bg=${wbg}]${wr_sep}" + "#[fg=${wfg},bg=${wbg}]${wl_sep}#[bg=${wfg}]${current_flags}#[fg=${wbg}]${spacer}${window_name_format}${spacer}#[fg=${wfg},bg=${wbg}]${wr_sep}" tmux set-window-option -g window-status-format \ - "#[fg=${bg_alt},bg=${wbg}]${wl_sep}#[bg=${bg_alt}]${flags}#[fg=${white}]${spacer}#I:#W${spacer}#[fg=${bg_alt},bg=${wbg}]${wr_sep}" + "#[fg=${bg_alt},bg=${wbg}]${wl_sep}#[bg=${bg_alt}]${flags}#[fg=${white}]${spacer}${window_name_format}${spacer}#[fg=${bg_alt},bg=${wbg}]${wr_sep}" else - tmux set-window-option -g window-status-current-format "#[fg=${wbg},bg=${wfg}] #I:#W${spacer}${current_flags} " - tmux set-window-option -g window-status-format "#[fg=${white},bg=${bg_alt}] #I:#W${spacer}${flags} " + tmux set-window-option -g window-status-current-format "#[fg=${wbg},bg=${wfg}] ${window_name_format}${spacer}${current_flags} " + tmux set-window-option -g window-status-format "#[fg=${white},bg=${bg_alt}] ${window_name_format}${spacer}${flags} " fi if $icons_only; then - tmux set-window-option -g window-status-current-format "#[fg=${wbg},bg=${wfg}]${spacer}#I:#W${spacer}" - tmux set-window-option -g window-status-format "#[fg=${white},bg=${wfg}]${spacer}#I:#W${spacer}" + tmux set-window-option -g window-status-current-format "#[fg=${wbg},bg=${wfg}]${spacer}${window_name_format}${spacer}" + tmux set-window-option -g window-status-format "#[fg=${white},bg=${wfg}]${spacer}${window_name_format}${spacer}" fi }