Update --bar formatting

This commit is contained in:
John Mertz 2022-08-23 11:58:00 -06:00
parent aa70b984c3
commit 58c03333a7
Signed by: jpm
GPG Key ID: E9C5EA2D867501AB
1 changed files with 8 additions and 2 deletions

View File

@ -97,7 +97,7 @@ if ($bar) {
my $json = JSON::XS->new();
my $powref = $json->decode($output);
my $class = 'discharging';
$output = '{"text": "';
$output = '';
if ($powref->{AC}->{Status} eq "Plugged-In") {
$class = 'charging';
$output .= "";
@ -114,7 +114,13 @@ if ($bar) {
} else {
$output .= "";
}
$output .= $powref->{Total}->{Percentage} . '%", "tooltip": "' . $class . '", "class": "' . $class . '"}';
$output = '{'
. '"text":"' . $output . '\u200a' . $powref->{Total}->{Percentage} . '%",'
. '"icon":"' . $output . '",'
. '"percentage":"' . $powref->{Total}->{Percentage} . '",'
. '"tooltip":"' . $class . '",'
. '"class":"' . $class . '"'
. '}';
} elsif ($pretty) {
use JSON::XS;
my $json = JSON::XS->new();