diff --git a/config.def.h b/config.def.h index af7a22d..e2acaf1 100644 --- a/config.def.h +++ b/config.def.h @@ -22,6 +22,7 @@ float bounce_freq = 1; /* determines the bounce frequency (if activated int sticky_history = True; int verbosity = 0; int word_wrap = False; +int ignore_newline = False; int line_height = 0; /* if line height < font height, it will be raised to font height */ int separator_height = 2; /* height of the separator line between two notifications */ diff --git a/dunst.c b/dunst.c index c4177d4..466087f 100644 --- a/dunst.c +++ b/dunst.c @@ -1078,6 +1078,10 @@ int init_notification(notification * n, int id) while (strstr(n->msg, "\\n") != NULL) n->msg = string_replace("\\n", "\n", n->msg); + if (ignore_newline) + while (strstr(n->msg, "\n") != NULL) + n->msg = string_replace("\n", " ", n->msg); + n->msg = rstrip(n->msg); @@ -1613,6 +1617,10 @@ void load_options(char *cmdline_config_path) word_wrap = option_get_bool("global", "word_wrap", "-word_wrap", word_wrap, "Truncating long lines or do word wrap"); + + ignore_newline = + option_get_bool("global", "ignore_newline", "-ignore_newline", + ignore_newline, "Ignore newline characters in notifications"); idle_threshold = option_get_int("global", "idle_threshold", "-idle_threshold", idle_threshold, diff --git a/dunstrc b/dunstrc index ed2b003..42f5053 100644 --- a/dunstrc +++ b/dunstrc @@ -30,9 +30,12 @@ # set to -1 to disable show_age_threshold = 60; - # split long notifications into multiple lines + # split notifications into multiple lines if they don't fit into geometry word_wrap = yes + # ignore newlines '\n' in notifications + ignore_newline = no + # the geometry of the window # geometry [{width}]x{height}][+/-{x}+/-{y}]