File tree Expand file tree Collapse file tree 4 files changed +33
-8
lines changed Expand file tree Collapse file tree 4 files changed +33
-8
lines changed Original file line number Diff line number Diff line change @@ -397,10 +397,10 @@ the notification window.
397397
398398Regardless of the status of the B<markup> setting, any markup tags that are
399399present in the format will be parsed. Note that because of that, if a literal
400- ampersand (&) is needed it needs to be escaped as '&'
400+ ampersand (&) is needed it needs to be escaped as '&'.
401401
402- If '\n' is present anywhere in the format, it will be replaced with
403- a literal newline.
402+ If '\n' or '\t' is present anywhere in the format, it will be replaced with
403+ a literal newline or tab respectively .
404404
405405If any of the following strings are present, they will be replaced with the
406406equivalent notification attribute.
@@ -416,6 +416,10 @@ For a complete markup reference, see
416416
417417=item B<%b> body
418418
419+ =item B<%c> category
420+
421+ =item B<%S> stack_tag
422+
419423=item B<%i> iconname (including its path)
420424
421425=item B<%I> iconname (without its path)
Original file line number Diff line number Diff line change 178178 # %a appname
179179 # %s summary
180180 # %b body
181+ # %c category
182+ # %U urgency (LOW, NORMAL, CRITICAL)
181183 # %i iconname (including its path)
182184 # %I iconname (without its path)
183185 # %p progress value if set ([ 0%] to [100%]) or nothing
Original file line number Diff line number Diff line change @@ -566,6 +566,7 @@ static void notification_format_message(struct notification *n)
566566 g_clear_pointer (& n -> msg , g_free );
567567
568568 n -> msg = string_replace_all ("\\n" , "\n" , g_strdup (n -> format ));
569+ n -> msg = string_replace_all ("\\t" , "\t" , n -> msg );
569570
570571 /* replace all formatter */
571572 for (char * substr = strchr (n -> msg , '%' );
@@ -597,6 +598,20 @@ static void notification_format_message(struct notification *n)
597598 n -> body ,
598599 n -> markup );
599600 break ;
601+ case 'c' :
602+ notification_replace_single_field (
603+ & n -> msg ,
604+ & substr ,
605+ n -> category ,
606+ MARKUP_NO );
607+ break ;
608+ case 'S' :
609+ notification_replace_single_field (
610+ & n -> msg ,
611+ & substr ,
612+ n -> stack_tag ,
613+ MARKUP_NO );
614+ break ;
600615 case 'I' :
601616 icon_tmp = g_strdup (n -> iconname );
602617 notification_replace_single_field (
Original file line number Diff line number Diff line change @@ -264,23 +264,27 @@ SUITE(suite_notification)
264264
265265 // TEST notification_format_message
266266 struct notification * a = notification_create ();
267- a -> appname = g_strdup ("MyApp" );
268- a -> summary = g_strdup ("I've got a summary!" );
269- a -> body = g_strdup ("Look at my shiny <notification>" );
270- a -> iconname = g_strdup ("/this/is/my/icoknpath.png" );
267+ a -> appname = g_strdup ("MyApp" );
268+ a -> summary = g_strdup ("I've got a summary!" );
269+ a -> body = g_strdup ("Look at my shiny <notification>" );
270+ a -> category = g_strdup ("This category" );
271+ a -> iconname = g_strdup ("/this/is/my/icoknpath.png" );
272+ a -> stack_tag = g_strdup ("test" );
271273 a -> progress = 95 ;
272274
273275 const char * strings [] = {
274276 "%a" , "MyApp" ,
275277 "%s" , "I've got a summary!" ,
276278 "%b" , "Look at my shiny <notification>" ,
279+ "%c" , "This category" ,
280+ "%S" , "test" ,
277281 "%I" , "icoknpath.png" ,
278282 "%i" , "/this/is/my/icoknpath.png" ,
279283 "%p" , "[ 95%]" ,
280284 "%n" , "95" ,
281285 "%%" , "%" ,
282286 "%" , "%" ,
283- "%UNKNOWN " , "%UNKNOWN " ,
287+ "%WHATEVER " , "%WHATEVER " ,
284288 NULL
285289 };
286290
You can’t perform that action at this time.
0 commit comments