pause end resume

This commit is contained in:
Sascha Kruse 2012-12-05 19:03:28 +01:00
parent a509b80c47
commit 808b37508a
2 changed files with 23 additions and 1 deletions

20
dunst.c
View File

@ -70,6 +70,7 @@ static XScreenSaverInfo *screensaver_info;
static int font_h; static int font_h;
static bool print_notifications = false; static bool print_notifications = false;
static dimension_t window_dim; static dimension_t window_dim;
static bool pause_display = false;
bool dunst_grab_errored = false; bool dunst_grab_errored = false;
@ -323,6 +324,13 @@ void update_lists()
check_timeouts(); 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) { if (geometry.h == 0) {
limit = 0; limit = 0;
} else if (geometry.h == 1) { } else if (geometry.h == 1) {
@ -333,6 +341,7 @@ void update_lists()
limit = geometry.h; limit = geometry.h;
} }
/* move notifications from queue to displayed */ /* move notifications from queue to displayed */
while (!l_is_empty(notification_queue)) { while (!l_is_empty(notification_queue)) {
@ -906,6 +915,17 @@ int init_notification(notification * n, int id)
if (n == NULL) if (n == NULL)
return -1; 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; n->format = format;
apply_rules(n); apply_rules(n);

View File

@ -372,8 +372,10 @@ void notify(DBusMessage * dmsg)
} }
n->color_strings[ColFG] = fgcolor == NULL ? NULL : strdup(fgcolor); n->color_strings[ColFG] = fgcolor == NULL ? NULL : strdup(fgcolor);
n->color_strings[ColBG] = bgcolor == NULL ? NULL : strdup(bgcolor); n->color_strings[ColBG] = bgcolor == NULL ? NULL : strdup(bgcolor);
id = init_notification(n, replaces_id); id = init_notification(n, replaces_id);
map_win(); if (id > 0)
map_win();
reply = dbus_message_new_method_return(dmsg); reply = dbus_message_new_method_return(dmsg);