summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xfunctions/utilities.zsh4
-rwxr-xr-xpowerlevel9k.zsh-theme2
2 files changed, 2 insertions, 4 deletions
diff --git a/functions/utilities.zsh b/functions/utilities.zsh
index 69fd2ec8..127007fb 100755
--- a/functions/utilities.zsh
+++ b/functions/utilities.zsh
@@ -9,9 +9,7 @@
# Exits with 0 if a variable has been previously defined (even if empty)
# Takes the name of a variable that should be checked.
function defined() {
- local varname="$1"
-
- typeset -p "$varname" > /dev/null 2>&1
+ [[ ! -z "${(tP)1}" ]]
}
# Given the name of a variable and a default value, sets the variable
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index ab56d234..f3126b81 100755
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -498,7 +498,7 @@ prompt_battery() {
fi
fi
# return if POWERLEVEL9K_BATTERY_HIDE_ABOVE_THRESHOLD is set and the battery percentage is greater or equal
- if [[ -v "POWERLEVEL9K_BATTERY_HIDE_ABOVE_THRESHOLD" && "${bat_percent}" -ge $POWERLEVEL9K_BATTERY_HIDE_ABOVE_THRESHOLD ]]; then
+ if defined POWERLEVEL9K_BATTERY_HIDE_ABOVE_THRESHOLD && [[ "${bat_percent}" -ge $POWERLEVEL9K_BATTERY_HIDE_ABOVE_THRESHOLD ]]; then
return
fi