Add rule to ignore transient settings
This commit is contained in:
		
							parent
							
								
									02ba060490
								
							
						
					
					
						commit
						d4f6726944
					
				
							
								
								
									
										14
									
								
								config.def.h
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								config.def.h
									
									
									
									
									
								
							| @ -91,11 +91,11 @@ keyboard_shortcut context_ks = {.str = "none", | ||||
| rule_t default_rules[] = { | ||||
|         /* name can be any unique string. It is used to identify the rule in dunstrc to override it there */ | ||||
| 
 | ||||
|         /*   name,    appname,        summary,         body,  icon, category, msg_urgency, timeout,  urgency,  markup,       history_ignore,  new_icon, fg,   bg,        format,  script */ | ||||
|         {    "empty", NULL,           NULL,            NULL,  NULL, NULL,     -1,          -1,       -1,       MARKUP_NULL,  false,           NULL,     NULL, NULL,      NULL,    NULL}, | ||||
|         /* { "rule1", "notify-send",  NULL,            NULL,  NULL, NULL,     -1,          -1,       -1,       MARKUP_NULL,  false,           NULL,     NULL, NULL,      "%s %b", NULL}, */ | ||||
|         /* { "rule2", "Pidgin",       "*says*,         NULL,  NULL, NULL,     -1,          -1,       CRITICAL, MARKUP_NULL,  false,           NULL,     NULL, NULL,      NULL,    NULL}, */ | ||||
|         /* { "rule3", "Pidgin",       "*signed on*",   NULL,  NULL, NULL,     -1,          -1,       LOW,      MARKUP_NULL,  false,           NULL,     NULL, NULL,      NULL,    NULL}, */ | ||||
|         /* { "rule4", "Pidgin",       "*signed off*",  NULL,  NULL, NULL,     -1,          -1,       LOW,      MARKUP_NULL,  false,           NULL,     NULL, NULL,      NULL,    NULL}, */ | ||||
|         /* { "rule5", NULL,           "*foobar*",      NULL,  NULL, NULL,     -1,          -1,       -1,       MARKUP_NULL,  false,           NULL,     NULL, "#00FF00", NULL,    NULL}, */ | ||||
|         /*   name,    appname,       summary,        body, icon, category, msg_urgency, timeout, urgency,  markup,      history_ignore, match_transient, set_transient, new_icon, fg,   bg,        format,  script */ | ||||
|         {    "empty", NULL,          NULL,           NULL, NULL, NULL,     -1,          -1,      -1,       MARKUP_NULL, -1,             -1,              -1,            NULL,     NULL, NULL,      NULL,    NULL}, | ||||
|         /* { "rule1", "notify-send", NULL,           NULL, NULL, NULL,     -1,          -1,      -1,       MARKUP_NULL, -1,             -1,              -1,            NULL,     NULL, NULL,      "%s %b", NULL}, */ | ||||
|         /* { "rule2", "Pidgin",      "*says*,        NULL, NULL, NULL,     -1,          -1,      CRITICAL, MARKUP_NULL, -1,             -1,              -1,            NULL,     NULL, NULL,      NULL,    NULL}, */ | ||||
|         /* { "rule3", "Pidgin",      "*signed on*",  NULL, NULL, NULL,     -1,          -1,      LOW,      MARKUP_NULL, -1,             -1,              -1,            NULL,     NULL, NULL,      NULL,    NULL}, */ | ||||
|         /* { "rule4", "Pidgin",      "*signed off*", NULL, NULL, NULL,     -1,          -1,      LOW,      MARKUP_NULL, -1,             -1,              -1,            NULL,     NULL, NULL,      NULL,    NULL}, */ | ||||
|         /* { "rule5", NULL,          "*foobar*",     NULL, NULL, NULL,     -1,          -1,      -1,       MARKUP_NULL, -1,             -1,              -1,            NULL,     NULL, "#00FF00", NULL,    NULL}, */ | ||||
| }; | ||||
|  | ||||
| @ -18,6 +18,8 @@ void rule_apply(rule_t * r, notification * n) | ||||
|                 n->urgency = r->urgency; | ||||
|         if (r->history_ignore != -1) | ||||
|                 n->history_ignore = r->history_ignore; | ||||
|         if (r->set_transient != -1) | ||||
|                 n->transient = r->set_transient; | ||||
|         if (r->markup != MARKUP_NULL) | ||||
|                 n->markup = r->markup; | ||||
|         if (r->new_icon) { | ||||
| @ -66,6 +68,8 @@ void rule_init(rule_t * r) | ||||
|         r->markup = MARKUP_NULL; | ||||
|         r->new_icon = NULL; | ||||
|         r->history_ignore = false; | ||||
|         r->match_transient = -1; | ||||
|         r->set_transient = -1; | ||||
|         r->fg = NULL; | ||||
|         r->bg = NULL; | ||||
|         r->format = NULL; | ||||
| @ -81,6 +85,7 @@ bool rule_matches_notification(rule_t * r, notification * n) | ||||
|                 && (!r->body || !fnmatch(r->body, n->body, 0)) | ||||
|                 && (!r->icon || !fnmatch(r->icon, n->icon, 0)) | ||||
|                 && (!r->category || !fnmatch(r->category, n->category, 0)) | ||||
|                 && (r->match_transient == -1 || (r->match_transient == n->transient)) | ||||
|                 && (r->msg_urgency == -1 || r->msg_urgency == n->urgency)); | ||||
| } | ||||
| /* vim: set tabstop=8 shiftwidth=8 expandtab textwidth=0: */ | ||||
|  | ||||
| @ -23,6 +23,8 @@ typedef struct _rule_t { | ||||
|         int urgency; | ||||
|         enum markup_mode markup; | ||||
|         int history_ignore; | ||||
|         int match_transient; | ||||
|         int set_transient; | ||||
|         char *new_icon; | ||||
|         char *fg; | ||||
|         char *bg; | ||||
|  | ||||
| @ -636,6 +636,8 @@ void load_settings(char *cmdline_config_path) | ||||
|                 r->format = ini_get_string(cur_section, "format", r->format); | ||||
|                 r->new_icon = ini_get_string(cur_section, "new_icon", r->new_icon); | ||||
|                 r->history_ignore = ini_get_bool(cur_section, "history_ignore", r->history_ignore); | ||||
|                 r->match_transient = ini_get_bool(cur_section, "match_transient", r->match_transient); | ||||
|                 r->set_transient = ini_get_bool(cur_section, "set_transient", r->set_transient); | ||||
|                 r->script = ini_get_path(cur_section, "script", NULL); | ||||
|         } | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Benedikt Heine
						Benedikt Heine