From d93ba155719f7f4b98a840e1b93c3d4351c61d2f Mon Sep 17 00:00:00 2001 From: John Mertz Date: Tue, 19 Apr 2022 00:36:00 -0400 Subject: [PATCH] Improve output for bar --- thinkpad/pow.pl | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/thinkpad/pow.pl b/thinkpad/pow.pl index c49fd2b..57ac9eb 100755 --- a/thinkpad/pow.pl +++ b/thinkpad/pow.pl @@ -96,9 +96,8 @@ if ($bar) { use JSON::XS; my $json = JSON::XS->new(); my $powref = $json->decode($output); - my $icon; my $class = 'discharging'; - $output = '{"text": "' . $powref->{Total}->{Percentage} . '% '; + $output = '{"text": "'; if ($powref->{AC}->{Status} eq "Plugged-In") { $class = 'charging'; $output .= ""; @@ -115,7 +114,7 @@ if ($bar) { } else { $output .= ""; } - $output .= '", "tooltip": "' . $class . '", "class": "' . $class . '"}'; + $output .= $powref->{Total}->{Percentage} . '%", "tooltip": "' . $class . '", "class": "' . $class . '"}'; } elsif ($pretty) { use JSON::XS; my $json = JSON::XS->new();