summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReed Riley <john.reed.riley@gmail.com>2016-09-14 20:01:10 -0400
committerMarc Cornellà <marc.cornella@live.com>2016-09-15 02:01:10 +0200
commit59c66dbfc2b4749c3311550fa605e1e4fcf9496c (patch)
tree5e28c25d24d9df42c81681fe0a50f148ceaa660d
parentce4d8a5cadcccd79909d97e42099540cfa50b9c3 (diff)
downloadzsh-59c66dbfc2b4749c3311550fa605e1e4fcf9496c.tar.gz
zsh-59c66dbfc2b4749c3311550fa605e1e4fcf9496c.tar.bz2
zsh-59c66dbfc2b4749c3311550fa605e1e4fcf9496c.zip
Fix battery plugin when acpi writes to stderr (#5413)
* Fix battery plugin when acpi writes to stderr * Make stderr redirection in battery plugin more idiomatic
-rw-r--r--plugins/battery/battery.plugin.zsh10
1 files changed, 5 insertions, 5 deletions
diff --git a/plugins/battery/battery.plugin.zsh b/plugins/battery/battery.plugin.zsh
index 014bb15dd..0bb9e77f0 100644
--- a/plugins/battery/battery.plugin.zsh
+++ b/plugins/battery/battery.plugin.zsh
@@ -67,12 +67,12 @@ if [[ "$OSTYPE" = darwin* ]] ; then
elif [[ $(uname) == "Linux" ]] ; then
function battery_is_charging() {
- ! [[ $(acpi 2&>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]]
+ ! [[ $(acpi 2>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]]
}
function battery_pct() {
if (( $+commands[acpi] )) ; then
- echo "$(acpi | cut -f2 -d ',' | tr -cd '[:digit:]')"
+ echo "$(acpi 2>/dev/null | cut -f2 -d ',' | tr -cd '[:digit:]')"
fi
}
@@ -85,14 +85,14 @@ elif [[ $(uname) == "Linux" ]] ; then
}
function battery_time_remaining() {
- if [[ $(acpi 2&>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then
- echo $(acpi | cut -f3 -d ',')
+ if [[ $(acpi 2>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then
+ echo $(acpi 2>/dev/null | cut -f3 -d ',')
fi
}
function battery_pct_prompt() {
b=$(battery_pct_remaining)
- if [[ $(acpi 2&>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then
+ if [[ $(acpi 2>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then
if [ $b -gt 50 ] ; then
color='green'
elif [ $b -gt 20 ] ; then