summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2014-02-06 11:36:08 -0500
committerJesse Luehrs <doy@tozt.net>2014-02-06 11:43:14 -0500
commit33c898b0ce910796d3f5255fe7bbc3e8a4101cbd (patch)
treecb8c10fb39197332017135f7b5b4cc37d22bc7e4 /bin
parent1581692d39b10eca543c74f53083fa3ec2ae4f31 (diff)
downloadconf-33c898b0ce910796d3f5255fe7bbc3e8a4101cbd.tar.gz
conf-33c898b0ce910796d3f5255fe7bbc3e8a4101cbd.zip
avoid an undef warning
Diffstat (limited to 'bin')
-rwxr-xr-xbin/status2
1 files changed, 1 insertions, 1 deletions
diff --git a/bin/status b/bin/status
index 0d3f9cc..c81c9d7 100755
--- a/bin/status
+++ b/bin/status
@@ -49,7 +49,7 @@ while (<$i3status>) {
if ($item->{name} eq 'battery') {
my ($state, $val) = $item->{full_text} =~ /(\w+) (\d+(?:\.\d+))%/;
($discharge_rate) = $item->{full_text} =~ /\(.* (.*)W\)/;
- $discharge_rate *= -1 if $state ne 'BAT';
+ $discharge_rate *= -1 if defined($discharge_rate) && $state ne 'BAT';
$item->{full_text} =~ s/\((.*) (.*)W\)/\($1\)/;
$item->{color} =
$val >= 80 ? '#00FF00'