summaryrefslogtreecommitdiff
path: root/powerlevel9k.zsh-theme
diff options
context:
space:
mode:
authorDominik Ritter <dritter03@googlemail.com>2015-11-24 20:17:04 +0300
committerDominik Ritter <dritter03@googlemail.com>2015-11-24 20:17:04 +0300
commitc8137fcf1a8461fddb98ada19e03c40834287c21 (patch)
treef0fd45a4527a74f0b886c42d69678ae23cd0eb7e /powerlevel9k.zsh-theme
parentdad38b0592141fc4243fb8c67659a3a499f6cc4c (diff)
Pre-Grep the raw data to save some memory and to avoid cluttering up the output of `setopt xtrace` too much.
Diffstat (limited to 'powerlevel9k.zsh-theme')
-rwxr-xr-xpowerlevel9k.zsh-theme4
1 files changed, 3 insertions, 1 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index 989f04ce..fb5e20d4 100755
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -220,7 +220,9 @@ prompt_battery() {
[[ -z $POWERLEVEL9K_BATTERY_FOREGROUND ]] && local icon_color="$DEFAULT_COLOR_INVERTED" || local icon_color="$POWERLEVEL9K_BATTERY_FOREGROUND"
if [[ $OS =~ OSX && -f /usr/sbin/ioreg && -x /usr/sbin/ioreg ]]; then
- local raw_data=$(ioreg -n AppleSmartBattery)
+ # Pre-Grep all needed informations to save some memory and
+ # as little pollution of the xtrace output as possible.
+ local raw_data=$(ioreg -n AppleSmartBattery | grep -E "MaxCapacity|TimeRemaining|CurrentCapacity|ExternalConnected|IsCharging")
# return if there is no battery on system
[[ -z $(echo $raw_data | grep MaxCapacity) ]] && return