diff options
Diffstat (limited to 'src/stclock.c')
-rw-r--r-- | src/stclock.c | 39 |
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"); |