Fix checks for battery plugin
These now check for the presence of the required function instead of checking for the battery file in the enabled directory.
This commit is contained in:
@@ -474,13 +474,15 @@ function battery_char {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ ! -e "$BASH_IT"/plugins/enabled/battery.plugin.bash ]; then
|
if ! command_exists battery_charge ; then
|
||||||
# if user has installed battery plugin, skip this...
|
# if user has installed battery plugin, skip this...
|
||||||
function battery_charge (){
|
function battery_charge (){
|
||||||
# no op
|
# no op
|
||||||
echo -n
|
echo -n
|
||||||
}
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! command_exists battery_char ; then
|
||||||
function battery_char (){
|
function battery_char (){
|
||||||
# no op
|
# no op
|
||||||
echo -n
|
echo -n
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ ___brainy_prompt_clock() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
___brainy_prompt_battery() {
|
___brainy_prompt_battery() {
|
||||||
[ ! -e $BASH_IT/plugins/enabled/battery.plugin.bash ] ||
|
! command_exists battery_percentage ||
|
||||||
[ "${THEME_SHOW_BATTERY}" != "true" ] && return
|
[ "${THEME_SHOW_BATTERY}" != "true" ] && return
|
||||||
info=$(battery_percentage)
|
info=$(battery_percentage)
|
||||||
color=$bold_green
|
color=$bold_green
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ ${D_BRANCH_COLOR}%b %r ${D_CHANGES_COLOR}%m%u ${D_DEFAULT_COLOR}"
|
|||||||
|
|
||||||
# checks if the plugin is installed before calling battery_charge
|
# checks if the plugin is installed before calling battery_charge
|
||||||
safe_battery_charge() {
|
safe_battery_charge() {
|
||||||
if [ -e "${BASH_IT}/plugins/enabled/battery.plugin.bash" ];
|
if command_exists battery_charge ;
|
||||||
then
|
then
|
||||||
battery_charge
|
battery_charge
|
||||||
fi
|
fi
|
||||||
@@ -127,4 +127,3 @@ ${D_INTERMEDIATE_COLOR}$ ${D_DEFAULT_COLOR}"
|
|||||||
|
|
||||||
# Runs prompt (this bypasses bash_it $PROMPT setting)
|
# Runs prompt (this bypasses bash_it $PROMPT setting)
|
||||||
safe_append_prompt_command prompt
|
safe_append_prompt_command prompt
|
||||||
|
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ ${D_BRANCH_COLOR}%b %r ${D_CHANGES_COLOR}%m%u ${D_DEFAULT_COLOR}"
|
|||||||
|
|
||||||
# checks if the plugin is installed before calling battery_charge
|
# checks if the plugin is installed before calling battery_charge
|
||||||
safe_battery_charge() {
|
safe_battery_charge() {
|
||||||
if [ -e "${BASH_IT}/plugins/enabled/battery.plugin.bash" ];
|
if command_exists battery_charge ;
|
||||||
then
|
then
|
||||||
battery_charge
|
battery_charge
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user