From 28b2fe894d524920f14f0c21a125fe7d347b2f23 Mon Sep 17 00:00:00 2001 From: Alessandro Zini Date: Mon, 18 Dec 2023 18:29:46 +0100 Subject: [PATCH] fix: status bar item duplication on conf reload 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 #54 --- src/_apply.tmuxsh | 8 ++++---- src/basic.tmuxtheme | 8 ++++---- src/powerline/_theme-options-block.tmuxsh | 4 ++-- src/powerline/_theme-options-default.tmuxsh | 4 ++-- src/powerline/_theme-options.tmuxsh | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/_apply.tmuxsh b/src/_apply.tmuxsh index d4c6b16..e18fbee 100644 --- a/src/_apply.tmuxsh +++ b/src/_apply.tmuxsh @@ -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}" diff --git a/src/basic.tmuxtheme b/src/basic.tmuxtheme index 3ae0c1e..5ccbdfd 100644 --- a/src/basic.tmuxtheme +++ b/src/basic.tmuxtheme @@ -33,11 +33,11 @@ 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 @@ -45,8 +45,8 @@ 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" diff --git a/src/powerline/_theme-options-block.tmuxsh b/src/powerline/_theme-options-block.tmuxsh index a29c191..845f68f 100644 --- a/src/powerline/_theme-options-block.tmuxsh +++ b/src/powerline/_theme-options-block.tmuxsh @@ -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} " diff --git a/src/powerline/_theme-options-default.tmuxsh b/src/powerline/_theme-options-default.tmuxsh index 29c08e0..323d1fe 100644 --- a/src/powerline/_theme-options-default.tmuxsh +++ b/src/powerline/_theme-options-default.tmuxsh @@ -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]" diff --git a/src/powerline/_theme-options.tmuxsh b/src/powerline/_theme-options.tmuxsh index 3bc034b..2e1dcda 100644 --- a/src/powerline/_theme-options.tmuxsh +++ b/src/powerline/_theme-options.tmuxsh @@ -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