From bd0bbdb727c0d1e775f774505577f6cddd4a968b Mon Sep 17 00:00:00 2001 From: John Mertz Date: Tue, 23 Aug 2022 11:58:00 -0600 Subject: [PATCH] Update --bar formatting --- thinkpad/pow.pl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/thinkpad/pow.pl b/thinkpad/pow.pl index 3c7b0fb..7ffdce6 100755 --- a/thinkpad/pow.pl +++ b/thinkpad/pow.pl @@ -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();