From 808b37508a1af59bcfae19c92dd13fcac5dd666d Mon Sep 17 00:00:00 2001 From: Sascha Kruse Date: Wed, 5 Dec 2012 19:03:28 +0100 Subject: [PATCH] pause end resume --- dunst.c | 20 ++++++++++++++++++++ dunst_dbus.c | 4 +++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/dunst.c b/dunst.c index 7debb34..8412a4c 100644 --- a/dunst.c +++ b/dunst.c @@ -70,6 +70,7 @@ static XScreenSaverInfo *screensaver_info; static int font_h; static bool print_notifications = false; static dimension_t window_dim; +static bool pause_display = false; bool dunst_grab_errored = false; @@ -323,6 +324,13 @@ void update_lists() check_timeouts(); + if (pause_display) { + while (!l_is_empty(displayed_notifications)) { + l_move(displayed_notifications, notification_queue, displayed_notifications->head); + } + return; + } + if (geometry.h == 0) { limit = 0; } else if (geometry.h == 1) { @@ -333,6 +341,7 @@ void update_lists() limit = geometry.h; } + /* move notifications from queue to displayed */ while (!l_is_empty(notification_queue)) { @@ -906,6 +915,17 @@ int init_notification(notification * n, int id) if (n == NULL) return -1; + + if (strcmp("DUNST_COMMAND_PAUSE", n->summary) == 0) { + pause_display = true; + return 0; + } + + if (strcmp("DUNST_COMMAND_RESUME", n->summary) == 0) { + pause_display = false; + return 0; + } + n->format = format; apply_rules(n); diff --git a/dunst_dbus.c b/dunst_dbus.c index e7a40af..f36745d 100644 --- a/dunst_dbus.c +++ b/dunst_dbus.c @@ -372,8 +372,10 @@ void notify(DBusMessage * dmsg) } n->color_strings[ColFG] = fgcolor == NULL ? NULL : strdup(fgcolor); n->color_strings[ColBG] = bgcolor == NULL ? NULL : strdup(bgcolor); + id = init_notification(n, replaces_id); - map_win(); + if (id > 0) + map_win(); reply = dbus_message_new_method_return(dmsg);