Add support for powerline_left and powerline_right

This commit is contained in:
Ceda EI 2021-09-22 13:25:12 +05:30
parent 7cb8857e5e
commit 58aefa063b
1 changed files with 9 additions and 4 deletions

13
wish.sh
View File

@ -1,4 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# shellcheck disable=SC1090
# INTERNAL USE ONLY! Do not use this in plugins. # INTERNAL USE ONLY! Do not use this in plugins.
function wish_print_right_prompt() { function wish_print_right_prompt() {
@ -26,6 +27,10 @@ function wish_init() {
break break
fi fi
done done
# Set defaults for core if not found
: "${WISH_POWERLINE_LEFT:=}"
: "${WISH_POWERLINE_RIGHT=}"
# Source all plugins # Source all plugins
# If WISH_CONFIG_FILE is not set, then assume that the user hasn't updated # If WISH_CONFIG_FILE is not set, then assume that the user hasn't updated
# to a config file yet. Set WISH_PLUGINS_SOURCE=WISH_PLUGINS. # to a config file yet. Set WISH_PLUGINS_SOURCE=WISH_PLUGINS.
@ -205,12 +210,12 @@ function wish_main() {
local next_plugin=${WISH_PLUGINS[$(($i+1))]} local next_plugin=${WISH_PLUGINS[$(($i+1))]}
local fg_name="WISH_${plugin^^}_BG" local fg_name="WISH_${plugin^^}_BG"
local bg_name="WISH_${next_plugin^^}_BG" local bg_name="WISH_${next_plugin^^}_BG"
wish_append ${!bg_name} ${!fg_name} wish_append ${!bg_name} ${!fg_name} "${WISH_POWERLINE_LEFT}"
fi fi
else else
local plugin=${WISH_PLUGINS[$i]} local plugin=${WISH_PLUGINS[$i]}
local fg_name="WISH_${plugin^^}_BG" local fg_name="WISH_${plugin^^}_BG"
wish_append -1 ${!fg_name} wish_append -1 ${!fg_name} "${WISH_POWERLINE_LEFT}"
fi fi
fi fi
fi fi
@ -223,13 +228,13 @@ function wish_main() {
if [[ $i == 0 ]]; then if [[ $i == 0 ]]; then
local plugin=${WISH_RIGHT_PLUGINS[$i]} local plugin=${WISH_RIGHT_PLUGINS[$i]}
local fg_name="WISH_${plugin^^}_BG" local fg_name="WISH_${plugin^^}_BG"
wish_append -1 ${!fg_name} wish_append -1 ${!fg_name} "${WISH_POWERLINE_RIGHT}"
elif wish_${WISH_RIGHT_PLUGINS[$(($i - 1))]}_start $prev; then elif wish_${WISH_RIGHT_PLUGINS[$(($i - 1))]}_start $prev; then
local plugin=${WISH_RIGHT_PLUGINS[$i]} local plugin=${WISH_RIGHT_PLUGINS[$i]}
local prev_plugin=${WISH_RIGHT_PLUGINS[$(($i-1))]} local prev_plugin=${WISH_RIGHT_PLUGINS[$(($i-1))]}
local fg_name="WISH_${plugin^^}_BG" local fg_name="WISH_${plugin^^}_BG"
local bg_name="WISH_${prev_plugin^^}_BG" local bg_name="WISH_${prev_plugin^^}_BG"
wish_append ${!bg_name} ${!fg_name} wish_append ${!bg_name} ${!fg_name} "${WISH_POWERLINE_RIGHT}"
fi fi
fi fi
fi fi