all repos — slstatus @ 367f8a8c44fc9dc05a0f7a2c1500111ca97f669c

my build of slstatus (tools.suckless.org/slstatus/)

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.
Tobias Tschinkowitz he4d@posteo.de
Fri, 18 May 2018 16:33:51 +0200
commit

367f8a8c44fc9dc05a0f7a2c1500111ca97f669c

parent

2604f25b16593ce73ac38982d5a227609b930e9e

1 files changed, 6 insertions(+), 2 deletions(-)

jump to
M components/battery.ccomponents/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;