summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--statusbar.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/statusbar.c b/statusbar.c
index 42406a0..08c0c86 100644
--- a/statusbar.c
+++ b/statusbar.c
@@ -4,6 +4,7 @@
#include <string.h>
#include <stdarg.h>
#include <time.h>
+#include <sys/statvfs.h>
#include <X11/Xlib.h>
#define INTERVAL 2
@@ -151,6 +152,19 @@ static void status_mem(void)
}
+static void status_disk(void)
+{
+ struct statvfs st;
+ double used;
+
+ if (statvfs("/", &st) == -1)
+ return;
+
+ used = (st.f_blocks - st.f_bfree) * 100.0 / st.f_blocks;
+ add_status("Disk %s%.f%s%%", used >= 90 ? HOT : COOL, used, NORMAL);
+}
+
+
static void status_net(void)
{
FILE *fp;
@@ -258,6 +272,7 @@ int main()
status_cpu();
status_mem();
+ status_disk();
status_net();
status_bat();
status_wifi();