make notification stacking optional

see #137
This commit is contained in:
Sascha Kruse 2014-01-22 10:41:42 +01:00
parent aa585017e0
commit bf6c1a6406
4 changed files with 53 additions and 44 deletions

View File

@ -27,6 +27,9 @@
# Show how many messages are currently hidden (because of geometry) # Show how many messages are currently hidden (because of geometry)
indicate_hidden = yes indicate_hidden = yes
# Stack duplicate Messages or show them individually
stack_duplicates = yes
# alignment of message text. # alignment of message text.
# Possible values are "left", "center" and "right" # Possible values are "left", "center" and "right"
alignment = left alignment = left

View File

@ -315,6 +315,7 @@ int notification_init(notification * n, int id)
n->dup_count = 0; n->dup_count = 0;
/* check if n is a duplicate */ /* check if n is a duplicate */
if (settings.stack_duplicates) {
for (GList * iter = g_queue_peek_head_link(queue); iter; for (GList * iter = g_queue_peek_head_link(queue); iter;
iter = iter->next) { iter = iter->next) {
notification *orig = iter->data; notification *orig = iter->data;
@ -365,6 +366,7 @@ int notification_init(notification * n, int id)
return orig->id; return orig->id;
} }
} }
}
/* urgency > CRIT -> array out of range */ /* urgency > CRIT -> array out of range */
n->urgency = n->urgency > CRIT ? CRIT : n->urgency; n->urgency = n->urgency > CRIT ? CRIT : n->urgency;

View File

@ -175,6 +175,9 @@ void load_settings(char *cmdline_config_path)
} }
} }
settings.stack_duplicates = option_get_bool("global", "stack_duplicates",
"-stack_duplicates", true, "Merge multiple notifications with the same content");
settings.startup_notification = settings.startup_notification =
option_get_bool("global", "startup_notification", option_get_bool("global", "startup_notification",
"-startup_notification", false, "-startup_notification", false,

View File

@ -4,6 +4,7 @@
typedef struct _settings { typedef struct _settings {
bool print_notifications; bool print_notifications;
bool allow_markup; bool allow_markup;
bool stack_duplicates;
char *font; char *font;
char *normbgcolor; char *normbgcolor;
char *normfgcolor; char *normfgcolor;