From: Andreas Fink Date: Mon, 16 Nov 2009 17:54:46 +0000 (+0000) Subject: *add* clock tooltip finished, see issue 115 X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=0a43eba2b74224ce55ff7ea3cfaaf25758f2e582;p=chaz%2Ftint2 *add* clock tooltip finished, see issue 115 *fix* reset sigmask before forking --- diff --git a/src/clock/clock.c b/src/clock/clock.c index 200996e..b5c3e41 100644 --- a/src/clock/clock.c +++ b/src/clock/clock.c @@ -23,6 +23,7 @@ #include #include #include +#include #include "window.h" #include "server.h" @@ -61,6 +62,7 @@ void update_clocks() const char* clock_get_tooltip(void* obj) { + strftime(buf_tooltip, sizeof(buf_tooltip), time_tooltip_format, localtime(&time_clock.tv_sec)); return buf_tooltip; } @@ -261,7 +263,11 @@ void clock_action(int button) } if (command) { pid_t pid; + sigset_t sigset; + sigprocmask(SIG_SETMASK, &sigset, 0); + sigprocmask(SIG_UNBLOCK, &sigset, 0); pid = fork(); + sigprocmask(SIG_BLOCK, &sigset, 0); if (pid == 0) { execl("/bin/sh", "/bin/sh", "-c", command, NULL); _exit(0); diff --git a/src/clock/clock.h b/src/clock/clock.h index 8652ec5..750a12e 100644 --- a/src/clock/clock.h +++ b/src/clock/clock.h @@ -26,6 +26,7 @@ typedef struct Clock { extern char *time1_format; extern char *time2_format; +extern char *time_tooltip_format; extern PangoFontDescription *time1_font_desc; extern PangoFontDescription *time2_font_desc; extern char *clock_lclick_command; diff --git a/src/config.c b/src/config.c index cc8d9f0..1e83404 100644 --- a/src/config.c +++ b/src/config.c @@ -382,6 +382,10 @@ void add_entry (char *key, char *value) memcpy(&panel_config.clock.area.pix.back, &a->pix.back, sizeof(Color)); memcpy(&panel_config.clock.area.pix.border, &a->pix.border, sizeof(Border)); } + else if (strcmp(key, "clock_tooltip") == 0) { + if (strlen(value) > 0) + time_tooltip_format = strdup (value); + } else if (strcmp(key, "clock_lclick_command") == 0) { if (strlen(value) > 0) clock_lclick_command = strdup(value);