diff options
-rw-r--r-- | tools/notify-send.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/notify-send.c b/tools/notify-send.c index aea3435..667f9d5 100644 --- a/tools/notify-send.c +++ b/tools/notify-send.c @@ -26,6 +26,7 @@ #include <stdlib.h> #include <string.h> #include <glib.h> +#include <glib-unix.h> #include <glib/gprintf.h> #define N_(x) (x) @@ -148,6 +149,19 @@ handle_closed (NotifyNotification *notify, g_main_loop_quit (loop); } +static gboolean +on_sigint (gpointer data) +{ + NotifyNotification *notification = data; + + g_printerr ("Wait cancelled, closing notification\n"); + + notify_notification_close (notification, NULL); + g_main_loop_quit (loop); + + return FALSE; +} + static void handle_action (NotifyNotification *notify, char *action, @@ -458,6 +472,7 @@ main (int argc, char *argv[]) } if (wait) { + g_unix_signal_add (SIGINT, on_sigint, notify); loop = g_main_loop_new (NULL, FALSE); g_main_loop_run (loop); g_main_loop_unref (loop); |