From 619076660b24b2ea2f837538332c3a1fd01d3d49 Mon Sep 17 00:00:00 2001 From: Andrei Gorgan Date: Sun, 21 Jul 2013 15:31:41 +0300 Subject: [PATCH] Add "show_indicators" option Add an option for disabling marking messages containing URLs or actions. This means that messages will not be displayed with "(U)" or "(A)" before them, but you can still use the context menu on them. --- config.def.h | 1 + dunstrc | 3 +++ notification.c | 5 +++-- settings.c | 4 ++++ settings.h | 1 + 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/config.def.h b/config.def.h index e4be36d..169683f 100644 --- a/config.def.h +++ b/config.def.h @@ -22,6 +22,7 @@ int show_age_threshold = -1; /* show age of notification, when notification i enum alignment align = left; /* text alignment [left/center/right] */ float bounce_freq = 1; /* determines the bounce frequency (if activated) */ int sticky_history = True; +int show_indicators = True; int verbosity = 0; int word_wrap = False; int ignore_newline = False; diff --git a/dunstrc b/dunstrc index 500f9cc..6825341 100644 --- a/dunstrc +++ b/dunstrc @@ -92,6 +92,9 @@ # timeout as if it would normally do. sticky_history = yes + # Display indicators for URLs (U) and actions (A) + show_indicators = yes + # The height of a single line. If the height is smaller than the font height, # it will get raised to the font height. # This adds empty space above and under the text. diff --git a/notification.c b/notification.c index 83722d2..0156970 100644 --- a/notification.c +++ b/notification.c @@ -501,12 +501,13 @@ void notification_update_text_to_render(notification *n) char *msg = g_strstrip(n->msg); /* print dup_count and msg */ - if (n->dup_count > 0 && (n->actions || n->urls)) { + if (n->dup_count > 0 && (n->actions || n->urls) + && settings.show_indicators) { buf = g_strdup_printf("(%d%s%s) %s", n->dup_count, n->actions ? "A" : "", n->urls ? "U" : "", msg); - } else if (n->actions || n->urls) { + } else if ((n->actions || n->urls) && settings.show_indicators) { buf = g_strdup_printf("(%s%s) %s", n->actions ? "A" : "", n->urls ? "U" : "", msg); diff --git a/settings.c b/settings.c index 0e0218f..3fd1a4f 100644 --- a/settings.c +++ b/settings.c @@ -138,6 +138,10 @@ void load_settings(char *cmdline_config_path) option_get_bool("global", "sticky_history", "-sticky_history", sticky_history, "Don't timeout notifications popped up from history"); + settings.show_indicators = + option_get_bool("global", "show_indicators", "-show_indicators", + show_indicators, + "Show indicators for actions \"(A)\" and URLs \"(U)\""); settings.separator_height = option_get_int("global", "separator_height", "-sep_height/-separator_height", separator_height, diff --git a/settings.h b/settings.h index fed0a70..64ef520 100644 --- a/settings.h +++ b/settings.h @@ -23,6 +23,7 @@ typedef struct _settings { enum alignment align; float bounce_freq; int sticky_history; + int show_indicators; int verbosity; int word_wrap; int ignore_newline;