From 8e98790c1d07cd2d808235f353d087d25b6dde3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Felipe=20S=C3=A1nchez?= Date: Fri, 26 May 2017 13:35:11 -0500 Subject: [PATCH] Update atomic.theme.bash - Changed the dependence of the battery plug-in. - Now checking if the function of the battery plugin exists, otherwise it will not load. --- themes/atomic/atomic.theme.bash | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/themes/atomic/atomic.theme.bash b/themes/atomic/atomic.theme.bash index 68515edd..e42db6e2 100644 --- a/themes/atomic/atomic.theme.bash +++ b/themes/atomic/atomic.theme.bash @@ -27,6 +27,8 @@ Face="\342\230\273" ## Parsers ## ############# +isFunction() { [[ "$(declare -Ff "$1")" ]]; } + ____atomic_top_left_parse() { ifs_old="${IFS}" IFS="|" @@ -164,8 +166,8 @@ ___atomic_prompt_clock() { } ___atomic_prompt_battery() { - [ ! -e "$BASH_IT"/plugins/enabled/battery.plugin.bash ] || - [ "${THEME_SHOW_BATTERY}" != "true" ] && return + chk=$(isFunction battery_percentage && echo yes || echo no) + [ "$chk" != "yes" ] || [ "${THEME_SHOW_BATTERY}" != "true" ] && return batp=$(battery_percentage) if [ "$batp" -gt 50 ]; then color=$bold_green