summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/stmail.c38
1 files changed, 38 insertions, 0 deletions
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");