Skip to content

Commit

Permalink
feat: make window name configurable (#28)
Browse files Browse the repository at this point in the history
* feat: make window fomat configurable

* chore: remove local window_name_format

* chore: write usage of new config.
  • Loading branch information
cry999 authored Jan 2, 2025
1 parent 0231113 commit 5e11cd8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 7 additions & 6 deletions scripts/tmux2k.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 5e11cd8

Please sign in to comment.