mirror of https://gitlab.com/ceda_ei/wish
Set plain as fallback theme if theme not found. Better variable names.
This commit is contained in:
parent
2c6c83b826
commit
ab5df51c2a
32
wish.sh
32
wish.sh
|
@ -2,26 +2,36 @@
|
||||||
|
|
||||||
function wish_init() {
|
function wish_init() {
|
||||||
# Source all plugins
|
# Source all plugins
|
||||||
local i
|
local plugin
|
||||||
local j
|
local path
|
||||||
for i in ${WISH_PLUGINS[@]}; do
|
for plugin in ${WISH_PLUGINS[@]}; do
|
||||||
for j in "$XDG_CONFIG_HOME" "/usr/share" "$HOME/.config"; do
|
for path in "$XDG_CONFIG_HOME" "/usr/share" "$HOME/.config"; do
|
||||||
source "$j/wish/plugins/$i.sh" &> /dev/null && break
|
source "$path/wish/plugins/$plugin.sh" &> /dev/null && break
|
||||||
done
|
done
|
||||||
[[ $? -ne 0 ]] && echo "Plugin $i not found." >&2
|
[[ $? -ne 0 ]] && echo "Plugin $i not found." >&2
|
||||||
done
|
done
|
||||||
|
|
||||||
# Source theme
|
# Source theme
|
||||||
WISH_THEME=${WISH_THEME:-plain}
|
WISH_THEME=${WISH_THEME:-plain}
|
||||||
for i in "$XDG_CONFIG_HOME" "/usr/share" "$HOME/.config"; do
|
while :; do
|
||||||
source "$i/wish/themes/$WISH_THEME.sh" &> /dev/null && break
|
for theme in "$XDG_CONFIG_HOME" "/usr/share" "$HOME/.config"; do
|
||||||
|
source "$theme/wish/themes/$WISH_THEME.sh" &> /dev/null && break
|
||||||
|
done
|
||||||
|
if [[ $? -eq 0 ]]; then
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo "Theme $WISH_THEME not found. Using theme plain." >&2
|
||||||
|
if [[ $WISH_THEME == "plain" ]]; then
|
||||||
|
break
|
||||||
|
else
|
||||||
|
WISH_THEME=plain
|
||||||
|
fi
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
[[ $? -ne 0 ]] && echo "Theme $WISH_THEME not found." >&2
|
|
||||||
|
|
||||||
# Call plugins to set colors
|
# Call plugins to set colors
|
||||||
for i in ${WISH_PLUGINS[@]}; do
|
for plugin in ${WISH_PLUGINS[@]}; do
|
||||||
eval wish_$(echo $i)_set_colors $prev
|
eval wish_$(echo $plugin)_set_colors $prev
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue