i3status-anyevent: upower does not provide "time to" value if battery fully chrged
This commit is contained in:
@@ -353,10 +353,11 @@ sub add_events () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unless (defined $time_to && defined $percentage && defined $state) {
|
unless (defined $percentage && defined $state) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (defined $time_to) {
|
||||||
chomp $time_to;
|
chomp $time_to;
|
||||||
|
|
||||||
if (substr ($time_to, -7) eq 'minutes') {
|
if (substr ($time_to, -7) eq 'minutes') {
|
||||||
@@ -370,6 +371,10 @@ sub add_events () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$time_to = sprintf '%02d:%02d', $hours, $minutes;
|
$time_to = sprintf '%02d:%02d', $hours, $minutes;
|
||||||
|
} else {
|
||||||
|
$time_to = "00:00";
|
||||||
|
}
|
||||||
|
|
||||||
$charge = sprintf '⚡ %s %s %s', $percentage, $state, $time_to;
|
$charge = sprintf '⚡ %s %s %s', $percentage, $state, $time_to;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user