diff options
author | Jos Dehaes <jos.dehaes@gmail.com> | 2021-10-05 23:42:17 +0200 |
---|---|---|
committer | aristocratos <gnmjpl@gmail.com> | 2021-10-06 12:45:30 +0200 |
commit | 8d86011d72a07b3f86f6b525b026b805667a3172 (patch) | |
tree | 2393fb0f9f103de2efdadf7422c1457d30c09f21 | |
parent | a9b64d62e4abf96fe3edcfa660871caef2041d0f (diff) |
battery states
-rw-r--r-- | src/osx/btop_collect.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
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; } |