Skip to content

Commit 5e11cd8

Browse files
authored
feat: make window name configurable (#28)
* feat: make window fomat configurable * chore: remove local window_name_format * chore: write usage of new config.
1 parent 0231113 commit 5e11cd8

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,11 @@ set -g @tmux2k-time-format "%F %R"
157157

158158
# network interface to watch
159159
set -g @tmux2k-network-name "wlo1"
160+
161+
# fully custom window name format.
162+
# see also FORMATS and STYLES sections in tmux(1)
163+
set -g @tmux2k-window-name-format "█ #{window_index} #{window_name}:#{b:pane_current_path}"
164+
160165
```
161166

162167
#### 🪆 Add New Plugins

scripts/tmux2k.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ source "$current_dir"/utils.sh
77

88
show_powerline=$(get_tmux_option "@tmux2k-show-powerline" true)
99
window_list_alignment=$(get_tmux_option "@tmux2k-window-list-alignment" 'absolute-centre')
10+
window_name_format=$(get_tmux_option "@tmux2k-window-name-format" '#I:#W')
1011
refresh_rate=$(get_tmux_option "@tmux2k-refresh-rate" 60)
1112
start_icon=$(get_tmux_option "@tmux2k-start-icon" "session")
1213
l_sep=$(get_tmux_option "@tmux2k-left-sep")
@@ -257,17 +258,17 @@ window_list() {
257258

258259
if $show_powerline; then
259260
tmux set-window-option -g window-status-current-format \
260-
"#[fg=${wfg},bg=${wbg}]${wl_sep}#[bg=${wfg}]${current_flags}#[fg=${wbg}]${spacer}#I:#W${spacer}#[fg=${wfg},bg=${wbg}]${wr_sep}"
261+
"#[fg=${wfg},bg=${wbg}]${wl_sep}#[bg=${wfg}]${current_flags}#[fg=${wbg}]${spacer}${window_name_format}${spacer}#[fg=${wfg},bg=${wbg}]${wr_sep}"
261262
tmux set-window-option -g window-status-format \
262-
"#[fg=${bg_alt},bg=${wbg}]${wl_sep}#[bg=${bg_alt}]${flags}#[fg=${white}]${spacer}#I:#W${spacer}#[fg=${bg_alt},bg=${wbg}]${wr_sep}"
263+
"#[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}"
263264
else
264-
tmux set-window-option -g window-status-current-format "#[fg=${wbg},bg=${wfg}] #I:#W${spacer}${current_flags} "
265-
tmux set-window-option -g window-status-format "#[fg=${white},bg=${bg_alt}] #I:#W${spacer}${flags} "
265+
tmux set-window-option -g window-status-current-format "#[fg=${wbg},bg=${wfg}] ${window_name_format}${spacer}${current_flags} "
266+
tmux set-window-option -g window-status-format "#[fg=${white},bg=${bg_alt}] ${window_name_format}${spacer}${flags} "
266267
fi
267268

268269
if $icons_only; then
269-
tmux set-window-option -g window-status-current-format "#[fg=${wbg},bg=${wfg}]${spacer}#I:#W${spacer}"
270-
tmux set-window-option -g window-status-format "#[fg=${white},bg=${wfg}]${spacer}#I:#W${spacer}"
270+
tmux set-window-option -g window-status-current-format "#[fg=${wbg},bg=${wfg}]${spacer}${window_name_format}${spacer}"
271+
tmux set-window-option -g window-status-format "#[fg=${white},bg=${wfg}]${spacer}${window_name_format}${spacer}"
271272
fi
272273
}
273274

0 commit comments

Comments
 (0)