diff options
author | awy <awy@awy.one> | 2025-09-13 12:59:29 +0300 |
---|---|---|
committer | awy <awy@awy.one> | 2025-09-13 12:59:29 +0300 |
commit | 3e6a7d369b880413c1d9679fb7677e878fdbb45a (patch) | |
tree | 03e3e1163335808816fe924cb329beb80eceb609 /src/stmemory.c | |
parent | f45554776ae470a8b8764f3fe5c7c400e76839d6 (diff) | |
download | statusbar-3e6a7d369b880413c1d9679fb7677e878fdbb45a.tar.gz |
Diffstat (limited to 'src/stmemory.c')
-rw-r--r-- | src/stmemory.c | 34 |
1 files changed, 34 insertions, 0 deletions
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 @@ <https://www.gnu.org/licenses/>. */ #include <stdio.h> +#include <stdlib.h> #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"); |