clean merge
This commit is contained in:
parent
6cbadb5d5d
commit
823fa0e360
|
@ -47,10 +47,6 @@ foreach (@devices) {
|
||||||
close $t;
|
close $t;
|
||||||
$output .= '"Type":"' . $type . '"';
|
$output .= '"Type":"' . $type . '"';
|
||||||
if ($name =~ /BAT[0-9]+/) {
|
if ($name =~ /BAT[0-9]+/) {
|
||||||
<<<<<<< Updated upstream
|
|
||||||
$nobat = 0;
|
|
||||||
=======
|
|
||||||
>>>>>>> Stashed changes
|
|
||||||
open(my $s,'<',"$_/status");
|
open(my $s,'<',"$_/status");
|
||||||
my $status = <$s>;
|
my $status = <$s>;
|
||||||
chomp $status;
|
chomp $status;
|
||||||
|
@ -88,13 +84,6 @@ foreach (@devices) {
|
||||||
. '"';
|
. '"';
|
||||||
}
|
}
|
||||||
$output .= "},";
|
$output .= "},";
|
||||||
<<<<<<< Updated upstream
|
|
||||||
}
|
|
||||||
unless ($nobat) {
|
|
||||||
print('{"AC":{"Type":"AC","Status":"Plugged-In"}}');
|
|
||||||
exit();
|
|
||||||
=======
|
|
||||||
>>>>>>> Stashed changes
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$battery_total{'percentage'} = sprintf("%0d",
|
$battery_total{'percentage'} = sprintf("%0d",
|
||||||
|
@ -115,7 +104,6 @@ if ($bar) {
|
||||||
my $class = 'discharging';
|
my $class = 'discharging';
|
||||||
$output = '';
|
$output = '';
|
||||||
if ($powref->{AC}->{Status} eq "Plugged-In") {
|
if ($powref->{AC}->{Status} eq "Plugged-In") {
|
||||||
<<<<<<< Updated upstream
|
|
||||||
$class = 'charging';
|
$class = 'charging';
|
||||||
$output .= "";
|
$output .= "";
|
||||||
} elsif ($powref->{Total}->{Percentage} <= 10) {
|
} elsif ($powref->{Total}->{Percentage} <= 10) {
|
||||||
|
@ -123,15 +111,6 @@ if ($bar) {
|
||||||
$output .= "";
|
$output .= "";
|
||||||
} elsif ($powref->{Total}->{Percentage} <= 35) {
|
} elsif ($powref->{Total}->{Percentage} <= 35) {
|
||||||
$class = 'low';
|
$class = 'low';
|
||||||
=======
|
|
||||||
$class = 'charging';
|
|
||||||
$output .= "";
|
|
||||||
} elsif ($powref->{Total}->{Percentage} <= 10) {
|
|
||||||
$class = 'critical';
|
|
||||||
$output .= "";
|
|
||||||
} elsif ($powref->{Total}->{Percentage} <= 35) {
|
|
||||||
$class = 'low';
|
|
||||||
>>>>>>> Stashed changes
|
|
||||||
$output .= "";
|
$output .= "";
|
||||||
} elsif ($powref->{Total}->{Percentage} <= 60) {
|
} elsif ($powref->{Total}->{Percentage} <= 60) {
|
||||||
$output .= "";
|
$output .= "";
|
||||||
|
@ -154,19 +133,11 @@ if ($bar) {
|
||||||
my $total = '';
|
my $total = '';
|
||||||
$output = "Device Status Percentage\n";
|
$output = "Device Status Percentage\n";
|
||||||
foreach my $device (keys %{$powref}) {
|
foreach my $device (keys %{$powref}) {
|
||||||
<<<<<<< Updated upstream
|
|
||||||
my $status;
|
my $status;
|
||||||
if ($powref->{$device}->{Status} eq "Plugged-In") {
|
if ($powref->{$device}->{Status} eq "Plugged-In") {
|
||||||
$status = "";
|
$status = "";
|
||||||
} elsif (!defined($powref->{$device}->{Percentage}) || $powref->{$device}->{Percentage} == 0) {
|
} elsif (!defined($powref->{$device}->{Percentage}) || $powref->{$device}->{Percentage} == 0) {
|
||||||
$status = " ";
|
$status = " ";
|
||||||
=======
|
|
||||||
my $status;
|
|
||||||
if ($powref->{$device}->{Status} eq "Plugged-In") {
|
|
||||||
$status = "";
|
|
||||||
} elsif (!defined($powref->{$device}->{Percentage}) || $powref->{$device}->{Percentage} == 0) {
|
|
||||||
$status = " ";
|
|
||||||
>>>>>>> Stashed changes
|
|
||||||
} elsif ($powref->{$device}->{Percentage} <= 10) {
|
} elsif ($powref->{$device}->{Percentage} <= 10) {
|
||||||
$status = " " . $powref->{$device}->{'Percentage'} . "%";
|
$status = " " . $powref->{$device}->{'Percentage'} . "%";
|
||||||
} elsif ($powref->{$device}->{Percentage} <= 35) {
|
} elsif ($powref->{$device}->{Percentage} <= 35) {
|
||||||
|
@ -175,7 +146,6 @@ if ($bar) {
|
||||||
$status = " " . $powref->{$device}->{'Percentage'} . "%";
|
$status = " " . $powref->{$device}->{'Percentage'} . "%";
|
||||||
} elsif ($powref->{$device}->{Percentage} <= 85) {
|
} elsif ($powref->{$device}->{Percentage} <= 85) {
|
||||||
$status = " " . $powref->{$device}->{'Percentage'} . "%";
|
$status = " " . $powref->{$device}->{'Percentage'} . "%";
|
||||||
<<<<<<< Updated upstream
|
|
||||||
} else {
|
} else {
|
||||||
$status = " " . $powref->{$device}->{'Percentage'} . "%";
|
$status = " " . $powref->{$device}->{'Percentage'} . "%";
|
||||||
}
|
}
|
||||||
|
@ -191,23 +161,6 @@ if ($bar) {
|
||||||
}
|
}
|
||||||
$output .= sprintf("%-24s %-12s %-12s\n", $name, $powref->{$device}->{Status}, $status);
|
$output .= sprintf("%-24s %-12s %-12s\n", $name, $powref->{$device}->{Status}, $status);
|
||||||
}
|
}
|
||||||
=======
|
|
||||||
} else {
|
|
||||||
$status = " " . $powref->{$device}->{'Percentage'} . "%";
|
|
||||||
}
|
|
||||||
if ($device eq 'Total') {
|
|
||||||
$total .= sprintf("%-24s %-12s", $device, $status);
|
|
||||||
} else {
|
|
||||||
#$output .= sprintf("%".length($powref->{$device->{'Type'}})."s (%".length($powref->{$device->{'Type'}})."s): %3d\%\n", $device, $device->{'Type'}, $device->{'Percentage'});
|
|
||||||
my $name = ' ('.$powref->{$device}->{'Type'}.')';
|
|
||||||
if ((length($device)+length($name)) >= 24) {
|
|
||||||
$name = substr($device, 0, (21-length($name))) . '...' . $name;
|
|
||||||
} else {
|
|
||||||
$name = substr(($device.$name), 0, 24);
|
|
||||||
}
|
|
||||||
$output .= sprintf("%-24s %-12s %-12s\n", $name, $powref->{$device}->{Status}, $status);
|
|
||||||
}
|
|
||||||
>>>>>>> Stashed changes
|
|
||||||
}
|
}
|
||||||
$output .= $total;
|
$output .= $total;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue