summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorawy <awy@awy.one>2025-09-11 17:51:55 +0300
committerawy <awy@awy.one>2025-09-11 17:51:55 +0300
commitf45554776ae470a8b8764f3fe5c7c400e76839d6 (patch)
tree9ff711cba9548d4bf5b23aff9a6fa4b7cf8f1c31
parentae9e88aa1f8050243ffcfd0c4c835c7ae83499d9 (diff)
downloadstatusbar-f45554776ae470a8b8764f3fe5c7c400e76839d6.tar.gz
stmail update
-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");