diff options
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"); |