Skip to content

Commit

Permalink
fix: status bar item duplication on conf reload
Browse files Browse the repository at this point in the history
This fixes a weird behavior where a custom status bar item (e.g. a prefix) would
be duplicated in the status bar after a configuration reload.

e.g. prior to this fix, setting:

  set -g @theme-status-left-prefix "test"

and reloading the configuration multiple times would result in multiple 'test'
strings being added as prefix.

Fixes jimeh#54
  • Loading branch information
aleeraser committed Dec 18, 2023
1 parent 7c59902 commit 28b2fe8
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions src/_apply.tmuxsh
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ set -goq @theme-window-status-prefix ""
set -goq @theme-window-status-suffix ""

# Apply prefixes and suffixes to @theme-* format options
set -gqF @theme-status-left "#{@theme-status-left-prefix}#{@theme-status-left}#{@theme-status-left-suffix}"
set -gqF @theme-status-right "#{@theme-status-right-prefix}#{@theme-status-right}#{@theme-status-right-suffix}"
set -gqF @theme-window-status-current-format "#{@theme-window-status-current-prefix}#{@theme-window-status-current-format}#{@theme-window-status-current-suffix}"
set -gqF @theme-window-status-format "#{@theme-window-status-prefix}#{@theme-window-status-format}#{@theme-window-status-suffix}"
set -gqF @theme-status-left "#{@theme-status-left-prefix}#{@theme-status-left-custom}#{@theme-status-left-suffix}"
set -gqF @theme-status-right "#{@theme-status-right-prefix}#{@theme-status-right_custom}#{@theme-status-right-suffix}"
set -gqF @theme-window-status-current-format "#{@theme-window-status-current-prefix}#{@theme-window-status-current-format-custom}#{@theme-window-status-current-suffix}"
set -gqF @theme-window-status-format "#{@theme-window-status-prefix}#{@theme-window-status-format-custom}#{@theme-window-status-suffix}"

# Apply @theme-* options to Tmux
set -gF display-panes-active-colour "#{@theme-display-panes-active-colour}"
Expand Down
8 changes: 4 additions & 4 deletions src/basic.tmuxtheme
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,20 @@ set -goq @theme-status-bg black
set -goq @theme-status-fg cyan
set -goq @theme-status-interval 1
set -goq @theme-status-justify centre
set -goqF @theme-status-left "#{@themepack-status-left-area-left-format} #[fg=white]» #[fg=yellow]#{@themepack-status-left-area-middle-format} #[fg=cyan]#{@themepack-status-left-area-right-format}"
set -goqF @theme-status-left-custom "#{@themepack-status-left-area-left-format} #[fg=white]» #[fg=yellow]#{@themepack-status-left-area-middle-format} #[fg=cyan]#{@themepack-status-left-area-right-format}"
set -goq @theme-status-left-bg black
set -goq @theme-status-left-fg green
set -goq @theme-status-left-length 40
set -goqF @theme-status-right "#{@themepack-status-right-area-left-format} #[fg=white]« #[fg=yellow]#{@themepack-status-right-area-middle-format} #[fg=green]#{@themepack-status-right-area-right-format}"
set -goqF @theme-status-right-custom "#{@themepack-status-right-area-left-format} #[fg=white]« #[fg=yellow]#{@themepack-status-right-area-middle-format} #[fg=green]#{@themepack-status-right-area-right-format}"
set -goq @theme-status-right-bg black
set -goq @theme-status-right-fg cyan
set -goq @theme-status-right-length 40
set -goq @theme-window-status-activity-bg black
set -goq @theme-window-status-activity-fg yellow
set -goq @theme-window-status-current-bg red
set -goq @theme-window-status-current-fg black
set -goqF @theme-window-status-current-format " #{@themepack-window-status-current-format} "
set -goqF @theme-window-status-format " #{@themepack-window-status-format} "
set -goqF @theme-window-status-current-format-custom " #{@themepack-window-status-current-format} "
set -goqF @theme-window-status-format-custom " #{@themepack-window-status-format} "
set -goq @theme-window-status-separator ""

#= include "_apply"
4 changes: 2 additions & 2 deletions src/powerline/_theme-options-block.tmuxsh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
set -goqF @theme-window-status-current-bg "#{@powerline-color-main-1}"
set -goqF @theme-window-status-current-fg "#{@powerline-color-black-1}"
set -goqF @theme-window-status-format " #{@themepack-window-status-format} "
set -goqF @theme-window-status-current-format " #{@themepack-window-status-current-format} "
set -goqF @theme-window-status-format-custom " #{@themepack-window-status-format} "
set -goqF @theme-window-status-current-format-custom " #{@themepack-window-status-current-format} "
4 changes: 2 additions & 2 deletions src/powerline/_theme-options-default.tmuxsh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
set -goqF @theme-window-status-current-bg "#{@powerline-color-black-1}"
set -goqF @theme-window-status-current-fg "#{@powerline-color-main-2}"
set -goqF @theme-window-status-format " #{@themepack-window-status-format} "
set -goqF @theme-window-status-current-format "#[fg=#{@theme-status-bg},bg=#{@theme-window-status-current-bg}]#[fg=#{@theme-window-status-current-fg},nobold] #{@themepack-window-status-current-format} #[fg=#{@theme-status-bg},bg=#{@theme-window-status-current-bg},nobold]"
set -goqF @theme-window-status-format-custom " #{@themepack-window-status-format} "
set -goqF @theme-window-status-current-format-custom "#[fg=#{@theme-status-bg},bg=#{@theme-window-status-current-bg}]#[fg=#{@theme-window-status-current-fg},nobold] #{@themepack-window-status-current-format} #[fg=#{@theme-status-bg},bg=#{@theme-window-status-current-bg},nobold]"

4 changes: 2 additions & 2 deletions src/powerline/_theme-options.tmuxsh
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ set -goqF @theme-status-bg "#{@powerline-status-bg}"
set -goqF @theme-status-fg "#{@powerline-status-fg}"
set -goq @theme-status-interval 1
set -goq @theme-status-justify centre
set -goqF @theme-status-left "#[fg=#{@powerline-status-left-area-left-fg},bg=#{@powerline-status-left-area-left-bg},bold] #{@themepack-status-left-area-left-format} #[fg=#{@powerline-status-left-area-left-bg},bg=#{@powerline-status-left-area-middle-bg},nobold]#[fg=#{@powerline-status-left-area-middle-fg},bg=#{@powerline-status-left-area-middle-bg}] #{@themepack-status-left-area-middle-format} #[fg=#{@powerline-status-left-area-middle-bg},bg=#{@powerline-status-left-area-right-bg}]#[fg=#{@powerline-status-left-area-right-fg},bg=#{@powerline-status-left-area-right-bg}] #{@themepack-status-left-area-right-format} #[fg=#{@powerline-status-left-area-right-bg},bg=#{@theme-status-bg},nobold]"
set -goqF @theme-status-left-custom "#[fg=#{@powerline-status-left-area-left-fg},bg=#{@powerline-status-left-area-left-bg},bold] #{@themepack-status-left-area-left-format} #[fg=#{@powerline-status-left-area-left-bg},bg=#{@powerline-status-left-area-middle-bg},nobold]#[fg=#{@powerline-status-left-area-middle-fg},bg=#{@powerline-status-left-area-middle-bg}] #{@themepack-status-left-area-middle-format} #[fg=#{@powerline-status-left-area-middle-bg},bg=#{@powerline-status-left-area-right-bg}]#[fg=#{@powerline-status-left-area-right-fg},bg=#{@powerline-status-left-area-right-bg}] #{@themepack-status-left-area-right-format} #[fg=#{@powerline-status-left-area-right-bg},bg=#{@theme-status-bg},nobold]"
set -goqF @theme-status-left-bg "#{@powerline-status-left-bg}"
set -goqF @theme-status-left-fg "#{@powerline-status-left-fg}"
set -goq @theme-status-left-length 40
set -goqF @theme-status-right "#[fg=#{@powerline-status-right-area-left-bg},bg=#{@theme-status-bg}]#[fg=#{@powerline-status-right-area-left-fg},bg=#{@powerline-status-right-area-left-bg}] #{@themepack-status-right-area-left-format} #[fg=#{@powerline-status-right-area-middle-bg},bg=#{@powerline-status-right-area-left-bg}]#[fg=#{@powerline-status-right-area-middle-fg},bg=#{@powerline-status-right-area-middle-bg}] #{@themepack-status-right-area-middle-format} #[fg=#{@powerline-status-right-area-right-bg},bg=#{@powerline-status-right-area-middle-bg}]#[fg=#{@powerline-status-right-area-right-fg},bg=#{@powerline-status-right-area-right-bg},bold] #{@themepack-status-right-area-right-format} "
set -goqF @theme-status-right-custom "#[fg=#{@powerline-status-right-area-left-bg},bg=#{@theme-status-bg}]#[fg=#{@powerline-status-right-area-left-fg},bg=#{@powerline-status-right-area-left-bg}] #{@themepack-status-right-area-left-format} #[fg=#{@powerline-status-right-area-middle-bg},bg=#{@powerline-status-right-area-left-bg}]#[fg=#{@powerline-status-right-area-middle-fg},bg=#{@powerline-status-right-area-middle-bg}] #{@themepack-status-right-area-middle-format} #[fg=#{@powerline-status-right-area-right-bg},bg=#{@powerline-status-right-area-middle-bg}]#[fg=#{@powerline-status-right-area-right-fg},bg=#{@powerline-status-right-area-right-bg},bold] #{@themepack-status-right-area-right-format} "
set -goqF @theme-status-right-bg "#{@powerline-status-right-bg}"
set -goqF @theme-status-right-fg "#{@powerline-status-right-fg}"
set -goq @theme-status-right-length 150
Expand Down

0 comments on commit 28b2fe8

Please sign in to comment.