]> Dogcows Code - chaz/tint2/blobdiff - src/clock/clock.c
clock command on rigt/left click by dmitry.medvinsky
[chaz/tint2] / src / clock / clock.c
index 79104c0d0df4adbf54207b8f25cac7aba6c66502..eaaf69cb83e8a3c493f39151f4d5778c8be72899 100644 (file)
@@ -22,6 +22,7 @@
 #include <cairo.h>
 #include <cairo-xlib.h>
 #include <pango/pangocairo.h>
+#include <unistd.h>
 
 #include "window.h"
 #include "server.h"
 #include "clock.h"
 
 
-char *time1_format = 0;
-char *time2_format = 0;
+char *time1_format;
+char *time2_format;
+char *clock_lclick_command;
+char *clock_rclick_command;
 struct timeval time_clock;
 int  time_precision;
 PangoFontDescription *time1_font_desc;
@@ -189,3 +192,25 @@ void resize_clock (void *obj)
    XFreePixmap (server.dsp, pmap);
 }
 
+
+void clock_action(int button)
+{
+       char *command = 0;
+       switch (button) {
+               case 1:
+               command = clock_lclick_command;
+               break;
+               case 3:
+               command = clock_rclick_command;
+               break;
+       }
+       if (command) {
+               pid_t pid;
+               pid = fork();
+               if (pid == 0) {
+                       execl("/bin/sh", "/bin/sh", "-c", command, NULL);
+                       _exit(0);
+               }
+       }
+}
+
This page took 0.020487 seconds and 4 git commands to generate.