summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Ball <nullspoon@oper.io>2021-06-17 22:52:17 -0600
committerAaron Ball <nullspoon@oper.io>2021-06-17 22:52:17 -0600
commit3c1dd9884a7249ec65d1b11c79e7051591b97a14 (patch)
tree9eb98dae273f6b3c8906fb8b5445c7ea5c64fe39
parentf21b4fcad43b147c3420e3976b8090a05d40dd2e (diff)
parente832123e64166ab44aff599eb91e59aa9cb9a55b (diff)
downloadi3cstat-3c1dd9884a7249ec65d1b11c79e7051591b97a14.tar.gz
i3cstat-3c1dd9884a7249ec65d1b11c79e7051591b97a14.tar.xz
Merge branch 'support-unconfigured-swap'
-rw-r--r--src/config_swap.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/config_swap.c b/src/config_swap.c
index 090117f..228085d 100644
--- a/src/config_swap.c
+++ b/src/config_swap.c
@@ -33,6 +33,14 @@ int config_swap_load(struct node* n) {
int percent;
sysinfo(&si);
+
+ // Return early if swap is not enabled
+ if(si.totalswap == 0) {
+ strcpy(n->color, C_YELLOW);
+ strcpy(n->text, "none");
+ return 0;
+ }
+
percent = (si.totalswap - si.freeswap) * 100 / si.totalswap;
if(percent < 20) {

Generated by cgit