Merge pull request #498 from shizeeg/master

per section 'frame_color' parameter
This commit is contained in:
Nikos Tsipinakis 2018-03-08 20:42:46 +02:00 committed by GitHub
commit d536ae723c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 18 additions and 3 deletions

View File

@ -594,7 +594,7 @@ Shell-like globing is supported.
=item B<modifying>
The following attributes can be overridden: timeout, urgency, foreground,
background, new_icon, set_transient, format, fullscreen where,
background, frame_color, new_icon, set_transient, format, fullscreen where,
as with the filtering attributes, each one corresponds to the respective
notification attribute to be modified.
@ -644,7 +644,7 @@ The progress value can be set with a hint, too.
=item notify-send -h string:fgcolor:#ff4444
=item notify-send -h string:bgcolor:#4444ff -h string:fgcolor:#ff4444
=item notify-send -h string:bgcolor:#4444ff -h string:fgcolor:#ff4444 -h string:frcolor:#44ff44
=item notify-send -h int:value:42 "Working ..."

View File

@ -279,7 +279,7 @@
# override settings for certain messages.
# Messages can be matched by "appname", "summary", "body", "icon", "category",
# "msg_urgency" and you can override the "timeout", "urgency", "foreground",
# "background", "new_icon" and "format", "fullscreen".
# "background", "frame_color", "new_icon" and "format", "fullscreen".
# Shell-like globbing will get expanded.
#
# SCRIPTING

View File

@ -147,6 +147,7 @@ static notification *dbus_message_to_notification(const gchar *sender, GVariant
gboolean transient = 0;
gchar *fgcolor = NULL;
gchar *bgcolor = NULL;
gchar *frcolor = NULL;
gchar *category = NULL;
RawImage *raw_icon = NULL;
@ -203,6 +204,12 @@ static notification *dbus_message_to_notification(const gchar *sender, GVariant
g_variant_unref(dict_value);
}
dict_value = g_variant_lookup_value(content, "frcolor", G_VARIANT_TYPE_STRING);
if (dict_value) {
frcolor = g_variant_dup_string(dict_value, NULL);
g_variant_unref(dict_value);
}
dict_value = g_variant_lookup_value(content, "category", G_VARIANT_TYPE_STRING);
if (dict_value) {
category = g_variant_dup_string(dict_value, NULL);
@ -289,6 +296,7 @@ static notification *dbus_message_to_notification(const gchar *sender, GVariant
n->colors[ColFG] = fgcolor;
n->colors[ColBG] = bgcolor;
n->colors[ColFrame] = frcolor;
notification_init(n);
return n;

View File

@ -38,6 +38,10 @@ void rule_apply(rule_t *r, notification *n)
g_free(n->colors[ColBG]);
n->colors[ColBG] = g_strdup(r->bg);
}
if (r->fc) {
g_free(n->colors[ColFrame]);
n->colors[ColFrame] = g_strdup(r->fc);
}
if (r->format)
n->format = r->format;
if (r->script)
@ -79,6 +83,7 @@ void rule_init(rule_t *r)
r->set_transient = -1;
r->fg = NULL;
r->bg = NULL;
r->fc = NULL;
r->format = NULL;
}

View File

@ -28,6 +28,7 @@ typedef struct _rule_t {
char *new_icon;
char *fg;
char *bg;
char *fc;
const char *format;
const char *script;
enum behavior_fullscreen fullscreen;

View File

@ -679,6 +679,7 @@ void load_settings(char *cmdline_config_path)
r->msg_urgency = ini_get_urgency(cur_section, "msg_urgency", r->msg_urgency);
r->fg = ini_get_string(cur_section, "foreground", r->fg);
r->bg = ini_get_string(cur_section, "background", r->bg);
r->fc = ini_get_string(cur_section, "frame_color", r->fc);
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);