Add history_ignore rule

Fixes #197
This commit is contained in:
Eizen 2017-02-08 18:10:44 -03:00
parent 3ef15065a3
commit ceddf57a31
6 changed files with 15 additions and 8 deletions

View File

@ -93,11 +93,11 @@ keyboard_shortcut context_ks = {.str = "none",
rule_t default_rules[] = { rule_t default_rules[] = {
/* name can be any unique string. It is used to identify the rule in dunstrc to override it there */ /* 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, new_icon, fg, bg, format, script */ /* 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, NULL, NULL, NULL, NULL, NULL}, { "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, NULL, NULL, NULL, "%s %b", 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, NULL, NULL, NULL, NULL, 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, 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, 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, NULL, NULL, "#00FF00", NULL, NULL }, */ /* { "rule5", NULL, "*foobar*", NULL, NULL, NULL, -1, -1, -1, MARKUP_NULL, false, NULL, NULL, "#00FF00", NULL, NULL}, */
}; };

View File

@ -177,6 +177,7 @@ void history_push(notification *n)
notification_free(to_free); notification_free(to_free);
} }
if (!n->history_ignore)
g_queue_push_tail(history, n); g_queue_push_tail(history, n);
} }

View File

@ -50,6 +50,7 @@ typedef struct _notification {
int progress; /* percentage + 1, 0 to hide */ int progress; /* percentage + 1, 0 to hide */
int line_count; int line_count;
int history_ignore;
const char *script; const char *script;
char *urls; char *urls;
Actions *actions; Actions *actions;

View File

@ -15,6 +15,8 @@ void rule_apply(rule_t * r, notification * n)
n->timeout = r->timeout; n->timeout = r->timeout;
if (r->urgency != -1) if (r->urgency != -1)
n->urgency = r->urgency; n->urgency = r->urgency;
if (r->history_ignore != -1)
n->history_ignore = r->history_ignore;
if (r->markup != MARKUP_NULL) if (r->markup != MARKUP_NULL)
n->markup = r->markup; n->markup = r->markup;
if (r->new_icon) { if (r->new_icon) {
@ -61,6 +63,7 @@ void rule_init(rule_t * r)
r->urgency = -1; r->urgency = -1;
r->markup = MARKUP_NULL; r->markup = MARKUP_NULL;
r->new_icon = NULL; r->new_icon = NULL;
r->history_ignore = false;
r->fg = NULL; r->fg = NULL;
r->bg = NULL; r->bg = NULL;
r->format = NULL; r->format = NULL;

View File

@ -22,6 +22,7 @@ typedef struct _rule_t {
int timeout; int timeout;
int urgency; int urgency;
enum markup_mode markup; enum markup_mode markup;
int history_ignore;
char *new_icon; char *new_icon;
char *fg; char *fg;
char *bg; char *bg;

View File

@ -582,6 +582,7 @@ void load_settings(char *cmdline_config_path)
r->bg = ini_get_string(cur_section, "background", r->bg); r->bg = ini_get_string(cur_section, "background", r->bg);
r->format = ini_get_string(cur_section, "format", r->format); r->format = ini_get_string(cur_section, "format", r->format);
r->new_icon = ini_get_string(cur_section, "new_icon", r->new_icon); 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->script = ini_get_string(cur_section, "script", NULL); r->script = ini_get_string(cur_section, "script", NULL);
} }