From 8d86011d72a07b3f86f6b525b026b805667a3172 Mon Sep 17 00:00:00 2001 From: Jos Dehaes Date: Tue, 5 Oct 2021 23:42:17 +0200 Subject: battery states --- src/osx/btop_collect.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/osx/btop_collect.cpp b/src/osx/btop_collect.cpp index 604c2fb..e695400 100644 --- a/src/osx/btop_collect.cpp +++ b/src/osx/btop_collect.cpp @@ -342,6 +342,13 @@ namespace Cpu { string p(perc); p.resize(3); percent = atoi(p.c_str()); + if (!strstr(buf, "discharging")) { + if (percent < 100) { + status = "charging"; + } else { + status = "full"; + } + } } else { has_battery = false; } -- cgit v1.2.3