Add script option to override shown icon

This commit is contained in:
Gjum 2014-03-01 14:53:30 +01:00
parent d0662e78ec
commit 5a5dab2ff3
5 changed files with 10 additions and 3 deletions

View File

@ -190,8 +190,8 @@
# Every section that isn't one of the above is interpreted as a rules to # Every section that isn't one of the above is interpreted as a rules to
# override settings for certain messages. # override settings for certain messages.
# Messages can be matched by "appname", "summary", "body" or "icon" and # Messages can be matched by "appname", "summary", "body" or "icon" and
# you can override the "timeout", "urgency", "foreground", "background" # you can override the "timeout", "urgency", "foreground", "background",
# and "format". # "new_icon", and "format".
# Shell-like globbing will get expanded. # Shell-like globbing will get expanded.
# #
# SCRIPTING # SCRIPTING
@ -223,11 +223,13 @@
# appname = Pidgin # appname = Pidgin
# summary = "*signed on*" # summary = "*signed on*"
# urgency = low # urgency = low
# new_icon = "/usr/share/pixmaps/pidgin/status/16/log-in.png"
# #
#[signed_off] #[signed_off]
# appname = Pidgin # appname = Pidgin
# summary = *signed off* # summary = *signed off*
# urgency = low # urgency = low
# new_icon = "/usr/share/pixmaps/pidgin/status/16/log-out.png"
# #
#[says] #[says]
# appname = Pidgin # appname = Pidgin

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->new_icon)
n->icon = r->new_icon;
if (r->fg) if (r->fg)
n->color_strings[ColFG] = r->fg; n->color_strings[ColFG] = r->fg;
if (r->bg) if (r->bg)
@ -50,6 +52,7 @@ void rule_init(rule_t * r)
r->icon = NULL; r->icon = NULL;
r->timeout = -1; r->timeout = -1;
r->urgency = -1; r->urgency = -1;
r->new_icon = NULL;
r->fg = NULL; r->fg = NULL;
r->bg = NULL; r->bg = NULL;
r->format = NULL; r->format = NULL;

View File

@ -17,6 +17,7 @@ typedef struct _rule_t {
/* actions */ /* actions */
int timeout; int timeout;
int urgency; int urgency;
char *new_icon;
char *fg; char *fg;
char *bg; char *bg;
const char *format; const char *format;

View File

@ -337,6 +337,7 @@ void load_settings(char *cmdline_config_path)
free(urg); free(urg);
} }
} }
r->new_icon = ini_get_string(cur_section, "new_icon", r->new_icon);
r->fg = ini_get_string(cur_section, "foreground", r->fg); r->fg = ini_get_string(cur_section, "foreground", r->fg);
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);

2
x.c
View File

@ -298,7 +298,7 @@ static cairo_t *get_icon_surface(char *icon_path)
fprintf(stderr, fprintf(stderr,
"Could not load icon: '%s'\n", icon_path); "Could not load icon: '%s'\n", icon_path);
} }
return NULL; return icon_surface;
} }
static colored_layout *r_init_shared(cairo_t *c, notification *n) static colored_layout *r_init_shared(cairo_t *c, notification *n)