parent
aa585017e0
commit
bf6c1a6406
3
dunstrc
3
dunstrc
@ -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
|
||||||
|
@ -315,54 +315,56 @@ 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 */
|
||||||
for (GList * iter = g_queue_peek_head_link(queue); iter;
|
if (settings.stack_duplicates) {
|
||||||
iter = iter->next) {
|
for (GList * iter = g_queue_peek_head_link(queue); iter;
|
||||||
notification *orig = iter->data;
|
iter = iter->next) {
|
||||||
if (strcmp(orig->appname, n->appname) == 0
|
notification *orig = iter->data;
|
||||||
&& strcmp(orig->summary, n->summary) == 0
|
if (strcmp(orig->appname, n->appname) == 0
|
||||||
&& strcmp(orig->body, n->body) == 0) {
|
&& strcmp(orig->summary, n->summary) == 0
|
||||||
/* If the progress differs this was probably intended to replace the notification
|
&& strcmp(orig->body, n->body) == 0) {
|
||||||
* but notify-send was used. So don't increment dup_count in this case
|
/* If the progress differs this was probably intended to replace the notification
|
||||||
*/
|
* but notify-send was used. So don't increment dup_count in this case
|
||||||
if (orig->progress == n->progress) {
|
*/
|
||||||
orig->dup_count++;
|
if (orig->progress == n->progress) {
|
||||||
} else {
|
orig->dup_count++;
|
||||||
orig->progress = n->progress;
|
} else {
|
||||||
|
orig->progress = n->progress;
|
||||||
|
}
|
||||||
|
/* notifications that differ only in progress hints should be expected equal,
|
||||||
|
* but we want the latest message, with the latest hint value
|
||||||
|
*/
|
||||||
|
free(orig->msg);
|
||||||
|
orig->msg = strdup(n->msg);
|
||||||
|
notification_free(n);
|
||||||
|
wake_up();
|
||||||
|
return orig->id;
|
||||||
}
|
}
|
||||||
/* notifications that differ only in progress hints should be expected equal,
|
|
||||||
* but we want the latest message, with the latest hint value
|
|
||||||
*/
|
|
||||||
free(orig->msg);
|
|
||||||
orig->msg = strdup(n->msg);
|
|
||||||
notification_free(n);
|
|
||||||
wake_up();
|
|
||||||
return orig->id;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
for (GList * iter = g_queue_peek_head_link(displayed); iter;
|
for (GList * iter = g_queue_peek_head_link(displayed); iter;
|
||||||
iter = iter->next) {
|
iter = iter->next) {
|
||||||
notification *orig = iter->data;
|
notification *orig = iter->data;
|
||||||
if (strcmp(orig->appname, n->appname) == 0
|
if (strcmp(orig->appname, n->appname) == 0
|
||||||
&& strcmp(orig->summary, n->summary) == 0
|
&& strcmp(orig->summary, n->summary) == 0
|
||||||
&& strcmp(orig->body, n->body) == 0) {
|
&& strcmp(orig->body, n->body) == 0) {
|
||||||
/* notifications that differ only in progress hints should be expected equal,
|
/* notifications that differ only in progress hints should be expected equal,
|
||||||
* but we want the latest message, with the latest hint value
|
* but we want the latest message, with the latest hint value
|
||||||
*/
|
*/
|
||||||
free(orig->msg);
|
free(orig->msg);
|
||||||
orig->msg = strdup(n->msg);
|
orig->msg = strdup(n->msg);
|
||||||
/* If the progress differs this was probably intended to replace the notification
|
/* If the progress differs this was probably intended to replace the notification
|
||||||
* but notify-send was used. So don't increment dup_count in this case
|
* but notify-send was used. So don't increment dup_count in this case
|
||||||
*/
|
*/
|
||||||
if (orig->progress == n->progress) {
|
if (orig->progress == n->progress) {
|
||||||
orig->dup_count++;
|
orig->dup_count++;
|
||||||
} else {
|
} else {
|
||||||
orig->progress = n->progress;
|
orig->progress = n->progress;
|
||||||
|
}
|
||||||
|
orig->start = time(NULL);
|
||||||
|
notification_free(n);
|
||||||
|
wake_up();
|
||||||
|
return orig->id;
|
||||||
}
|
}
|
||||||
orig->start = time(NULL);
|
|
||||||
notification_free(n);
|
|
||||||
wake_up();
|
|
||||||
return orig->id;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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,
|
||||||
|
@ -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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user