From f45554776ae470a8b8764f3fe5c7c400e76839d6 Mon Sep 17 00:00:00 2001 From: awy Date: Thu, 11 Sep 2025 17:51:55 +0300 Subject: stmail update --- src/stmail.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/stmail.c b/src/stmail.c index 405f8bb..e8b3d18 100644 --- a/src/stmail.c +++ b/src/stmail.c @@ -23,6 +23,42 @@ #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 *neomutt[] = { "sh", "-c", \ + "setsid -w -f \"$TERMINAL\" -e neomutt ; \ +pkill -RTMIN+12 \"${STATUSBAR:-waybar}\"", NULL }; + const char *mailup[] = { "mailup", NULL }; + + switch (button) { + case 1: + spawn(neomutt); + break; + case 2: + spawn(mailup); + break; + case 3: + sendnotif("stmail", " Mail module", + "- Shows unread mail\n- Shows  if syncing mail\n\ +- Left click opens neomutt\n\ +- Middle click to mute."); + break; + default: break; + } +} + int newmsg(char path[1024]) { @@ -54,6 +90,8 @@ main(void) char path[1024]; struct dirent *entry; + buttonhandler(); + if (!(env = getenv("XDG_DATA_HOME"))) die("XDG_DATA_HOME is not set"); -- cgit v1.2.3