summaryrefslogtreecommitdiff
path: root/src/stclock.c
diff options
context:
space:
mode:
authorawy <awy@awy.one>2025-09-11 17:35:32 +0300
committerawy <awy@awy.one>2025-09-11 17:35:32 +0300
commit75a1408e9d4e54af9695bc4eca650b35c22bcff2 (patch)
treee3efd40aa56b7b4d2f6fc1286ff9ac3e1ecc543a /src/stclock.c
parent796c9495a537b17bb985e9950ae0fdec123c12f1 (diff)
downloadstatusbar-75a1408e9d4e54af9695bc4eca650b35c22bcff2.tar.gz
BIG HAPPENING: notifications and spawn functionality
Diffstat (limited to 'src/stclock.c')
-rw-r--r--src/stclock.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/stclock.c b/src/stclock.c
index 22dae6a..ef63fe6 100644
--- a/src/stclock.c
+++ b/src/stclock.c
@@ -14,17 +14,56 @@
License along with stclock. If not, see
<https://www.gnu.org/licenses/>. */
+#include <stdlib.h>
#include <time.h>
#include <stdio.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", "calcurse", NULL };
+
+ switch (button) {
+ case 1:
+ sendnotif("stclock", "This Month",
+ "there should be calendar but you know how we doing");
+ break;
+ case 2:
+ spawn(termcmd);
+ break;
+ case 3:
+ sendnotif("stclock", " Time/date module",
+ "- Left click to show upcoming \
+appointments for the next three days\
+via `calcurse -d3` and show the month via `cal`\n\
+- Middle click opens calcurse if installed");
+ break;
+ default: break;
+ }
+}
+
int
main(void)
{
time_t t;
char buf[64];
+ buttonhandler();
+
t = time(NULL);
if (!strftime(buf, sizeof(buf), "%F %T", localtime(&t)))
die("strftime: Result string exceeds buffer size");