summaryrefslogtreecommitdiffstats
path: root/src/osx
diff options
context:
space:
mode:
authorJos Dehaes <jos.dehaes@gmail.com>2021-10-05 23:42:17 +0200
committerJos Dehaes <jos.dehaes@gmail.com>2021-10-05 23:42:17 +0200
commit096104c90b571e931a3a7d9c813dbfc9aa47e212 (patch)
tree39117026969c65319fb4037bc0188d0d38211f5d /src/osx
parent0ad93684c2a72293b23d6a2163c9ec51b499dfa3 (diff)
battery states
Diffstat (limited to 'src/osx')
-rw-r--r--src/osx/btop_collect.cpp7
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;
}