summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorTobias Tschinkowitz <he4d@posteo.de>2018-05-18 16:33:51 +0200
committerAaron Marcher <me@drkhsh.at>2018-05-18 16:35:32 +0200
commit57f1d43d9b931faa2fb1454529e05518e7b08010 (patch)
treee3880642c32682279ad9fab46a29aa808f00908c /components
parent22298d6bbce574a4db3df15f1b22c1cdb16d1234 (diff)
battery: fixed remaining time on connected AC
when an AC is connected apm_info shows a non-valid value for remaining minutes. it was decided that in that case the function should return an empty string.
Diffstat (limited to 'components')
-rw-r--r--components/battery.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/components/battery.c b/components/battery.c
index 53d94b5..84b2c11 100644
--- a/components/battery.c
+++ b/components/battery.c
@@ -121,8 +121,12 @@
struct apm_power_info apm_info;
if (load_apm_power_info(&apm_info)) {
- return bprintf("%u:%02u", apm_info.minutes_left / 60,
- apm_info.minutes_left % 60);
+ if (apm_info.ac_state != APM_AC_ON) {
+ return bprintf("%u:%02u", apm_info.minutes_left / 60,
+ apm_info.minutes_left % 60);
+ } else {
+ return strdup("");
+ }
}
return NULL;