Improve output for bar

This commit is contained in:
John Mertz 2022-04-19 00:36:00 -04:00
parent 51fa0fb452
commit d93ba15571
1 changed files with 2 additions and 3 deletions

View File

@ -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();