From dca498cdcd87f5f07504a84422de8d5ebd536771 Mon Sep 17 00:00:00 2001 From: Theoreticallyhugo Date: Wed, 16 Jul 2025 12:40:07 +0200 Subject: [PATCH] making padding customizable --- docs/CONFIG.md | 12 ++++++++++++ scripts/dracula.sh | 13 +++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/docs/CONFIG.md b/docs/CONFIG.md index 3f3f5bba..b349249a 100644 --- a/docs/CONFIG.md +++ b/docs/CONFIG.md @@ -88,6 +88,18 @@ Hide empty plugins set -g @dracula-show-empty-plugins false ``` +Set plugin padding +Whilst the padding is one space per default, can be whatever you want it to be, whether that's whitespace or other characters. +**If you want to remove any padding, you need to use a zero width space!** + +```bash +set -g @dracula-left-pad ' ° ' +set -g @dracula-right-pad ' ° ' +# no padding with zero width space +set -g @dracula-left-pad '​' +set -g @dracula-right-pad '​' +``` + ### Powerline - [up](#table-of-contents) Enable powerline symbols diff --git a/scripts/dracula.sh b/scripts/dracula.sh index fb869021..274272f8 100755 --- a/scripts/dracula.sh +++ b/scripts/dracula.sh @@ -38,6 +38,8 @@ main() { show_ssh_session_port=$(get_tmux_option "@dracula-show-ssh-session-port" false) show_libreview=$(get_tmux_option "@dracula-show-libreview" false) show_empty_plugins=$(get_tmux_option "@dracula-show-empty-plugins" true) + left_pad=$(get_tmux_option "@dracula-left-pad" " ") + right_pad=$(get_tmux_option "@dracula-right-pad" " ") narrow_mode=$(get_tmux_option "@dracula-narrow-mode" false) if $narrow_mode; then @@ -361,18 +363,21 @@ main() { background_color=${powerbg} fi + # padding + pad_script="$left_pad$script$right_pad" + if $show_powerline; then if $show_empty_plugins; then - tmux set-option -ga status-right " #[fg=${!colors[0]},bg=${background_color},nobold,nounderscore,noitalics]${right_sep}#[fg=${!colors[1]},bg=${!colors[0]}] $script $right_edge_icon" + tmux set-option -ga status-right " #[fg=${!colors[0]},bg=${background_color},nobold,nounderscore,noitalics]${right_sep}#[fg=${!colors[1]},bg=${!colors[0]}]$pad_script$right_edge_icon" else - tmux set-option -ga status-right "#{?#{==:$script,},,#[fg=${!colors[0]},nobold,nounderscore,noitalics] ${right_sep}#[fg=${!colors[1]},bg=${!colors[0]}] $script $right_edge_icon}" + tmux set-option -ga status-right "#{?#{==:$script,},,#[fg=${!colors[0]},nobold,nounderscore,noitalics]${right_sep}#[fg=${!colors[1]},bg=${!colors[0]}]$pad_script$right_edge_icon}" fi powerbg=${!colors[0]} else if $show_empty_plugins; then - tmux set-option -ga status-right "#[fg=${!colors[1]},bg=${!colors[0]}] $script " + tmux set-option -ga status-right "#[fg=${!colors[1]},bg=${!colors[0]}]$pad_script" else - tmux set-option -ga status-right "#{?#{==:$script,},,#[fg=${!colors[1]},bg=${!colors[0]}] $script }" + tmux set-option -ga status-right "#{?#{==:$script,},,#[fg=${!colors[1]},bg=${!colors[0]}]$pad_script}" fi fi