Add option to hide duplicates count

This commit is contained in:
Moritz Luedecke 2016-06-25 13:38:24 +02:00 committed by Eizen
parent 40905c9ff8
commit 30085f7abd
3 changed files with 8 additions and 3 deletions

View File

@ -586,8 +586,8 @@ void notification_update_text_to_render(notification *n)
char *msg = g_strstrip(n->msg); char *msg = g_strstrip(n->msg);
/* print dup_count and msg */ /* print dup_count and msg */
if (n->dup_count > 0 && (n->actions || n->urls) if ((n->dup_count > 0 && !settings.hide_duplicates_count)
&& settings.show_indicators) { && (n->actions || n->urls) && settings.show_indicators) {
buf = g_strdup_printf("(%d%s%s) %s", buf = g_strdup_printf("(%d%s%s) %s",
n->dup_count, n->dup_count,
n->actions ? "A" : "", n->actions ? "A" : "",
@ -596,7 +596,7 @@ void notification_update_text_to_render(notification *n)
buf = g_strdup_printf("(%s%s) %s", buf = g_strdup_printf("(%s%s) %s",
n->actions ? "A" : "", n->actions ? "A" : "",
n->urls ? "U" : "", msg); n->urls ? "U" : "", msg);
} else if (n->dup_count > 0) { } else if (n->dup_count > 0 && !settings.hide_duplicates_count) {
buf = g_strdup_printf("(%d) %s", n->dup_count, msg); buf = g_strdup_printf("(%d) %s", n->dup_count, msg);
} else { } else {
buf = g_strdup(msg); buf = g_strdup(msg);

View File

@ -171,6 +171,10 @@ void load_settings(char *cmdline_config_path)
option_get_int("global", "show_age_threshold", option_get_int("global", "show_age_threshold",
"-show_age_threshold", show_age_threshold, "-show_age_threshold", show_age_threshold,
"When should the age of the notification be displayed?"); "When should the age of the notification be displayed?");
settings.hide_duplicates_count =
option_get_bool("global", "hide_duplicates_count",
"-hide_duplicates_count", false,
"Hide count of the merged notifications with the same content");
settings.sticky_history = settings.sticky_history =
option_get_bool("global", "sticky_history", "-sticky_history", option_get_bool("global", "sticky_history", "-sticky_history",
sticky_history, sticky_history,

View File

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