From bd8fdbf782cdae67e47c8cffd0f86a50b8af8531 Mon Sep 17 00:00:00 2001 From: Igor Moura Date: Fri, 28 Jul 2017 01:28:49 -0300 Subject: [PATCH] Added plugged_in func for linux in battery plugin Cloned battery_is_charging() func with the same name as the osx version in order to maintain compatibility across the systems in themes that make use of the plugin. --- plugins/battery/battery.plugin.zsh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/battery/battery.plugin.zsh b/plugins/battery/battery.plugin.zsh index 8f398cfb..8f10763c 100644 --- a/plugins/battery/battery.plugin.zsh +++ b/plugins/battery/battery.plugin.zsh @@ -70,6 +70,10 @@ elif [[ "$OSTYPE" = linux* ]] ; then ! [[ $(acpi 2>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] } + function plugged_in() { + ! [[ $(acpi 2>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] + } + function battery_pct() { if (( $+commands[acpi] )) ; then echo "$(acpi 2>/dev/null | cut -f2 -d ',' | tr -cd '[:digit:]')"