aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2022-02-01 22:37:34 +0100
committerPřemysl Eric Janouch <p@janouch.name>2022-02-01 22:37:34 +0100
commit81c3c9ec3ff12febbb14ff6d806b2eae4c304980 (patch)
treecc666e18f52dd87f0d364b3b8310c3ca2076036f
parentfbc1f183934980e5477926baae034274b8277409 (diff)
downloaddesktop-tools-81c3c9ec3ff12febbb14ff6d806b2eae4c304980.tar.gz
desktop-tools-81c3c9ec3ff12febbb14ff6d806b2eae4c304980.tar.xz
desktop-tools-81c3c9ec3ff12febbb14ff6d806b2eae4c304980.zip
wmstatus: skip offline power supplies
-rw-r--r--wmstatus.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/wmstatus.c b/wmstatus.c
index a35ebc6..29cfa0f 100644
--- a/wmstatus.c
+++ b/wmstatus.c
@@ -1112,6 +1112,15 @@ try_power_supply (int dir, struct error **e)
return NULL;
}
+ bool offline = !read_number (dir, "online", &error);
+ if (error)
+ {
+ error_free (error);
+ error = NULL;
+ }
+ else if (offline)
+ return NULL;
+
bool is_relevant =
!strcmp (type, "Battery") ||
!strcmp (type, "USB") ||