From 3e6a7d369b880413c1d9679fb7677e878fdbb45a Mon Sep 17 00:00:00 2001 From: awy Date: Sat, 13 Sep 2025 12:59:29 +0300 Subject: updates --- src/stmemory.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'src/stmemory.c') diff --git a/src/stmemory.c b/src/stmemory.c index 4f1435a..863d9fc 100644 --- a/src/stmemory.c +++ b/src/stmemory.c @@ -15,9 +15,41 @@ . */ #include +#include #include "../lib/util.h" +void +buttonhandler() +{ + char *term; + char *env; + int button; + + button = 0; + if ((env = getenv("BLOCK_BUTTON"))) + button = getbtnint(env); + + if (!(term = getenv("TERMINAL"))) + term = "footclient"; + + const char *termcmd[] = { term, "-e", "btop", NULL }; + + switch (button) { + case 1: + break; + case 2: + spawn(termcmd); + break; + case 3: + sendnotif("stmemory", " Memory module", + "- Shows Memory Used.\n- Click to show memory hogs.\n\ +- Middle click to open btop."); + break; + default: break; + } +} + int main(void) { @@ -25,6 +57,8 @@ main(void) char line[256]; long total, free; + buttonhandler(); + if (!(fp = fopen("/proc/meminfo", "r"))) die("failed to open: /proc/meminfo"); -- cgit v1.2.3