added format to rules
This commit is contained in:
parent
4e7a12053d
commit
6d36786fc0
17
config.def.h
17
config.def.h
@ -21,20 +21,19 @@ char *key_string = "space"; /* set to NULL for no keybinging */
|
||||
KeySym mask = ControlMask;
|
||||
/* KeySym mask = ControlMask || Mod4Mask */
|
||||
|
||||
|
||||
int verbose = True; /* print info to stdout? */
|
||||
|
||||
|
||||
const rule_t rules[] = {
|
||||
/* appname, summary, body, icon, timeout, urgency, fg, bg */
|
||||
{ "notify-send", NULL, NULL, NULL, -1, -1, NULL, NULL },
|
||||
{ "Pidgin", NULL, NULL, NULL, -1, -1, NULL, NULL },
|
||||
{ "Pidgin", "*signed on*", NULL, NULL, -1, LOW, NULL, NULL },
|
||||
{ "Pidgin", "*signed off*", NULL, NULL, -1, LOW, NULL, NULL },
|
||||
{ "Pidgin", "*says*", NULL, NULL, -1, CRIT, NULL, NULL },
|
||||
{ "Pidgin", "twitter.com*", NULL, NULL, -1, NORM, NULL, NULL },
|
||||
/* appname, summary, body, icon, timeout, urgency, fg, bg, format */
|
||||
{ "notify-send", NULL, NULL, NULL, -1, -1, NULL, NULL, "%s %b" },
|
||||
{ "Pidgin", NULL, NULL, NULL, -1, -1, NULL, NULL, "%s %b" },
|
||||
{ "Pidgin", "*signed on*", NULL, NULL, -1, LOW, NULL, NULL, "%s %b" },
|
||||
{ "Pidgin", "*signed off*", NULL, NULL, -1, LOW, NULL, NULL, "%s %b" },
|
||||
{ "Pidgin", "*says*", NULL, NULL, -1, CRIT, NULL, NULL, "%s %b" },
|
||||
{ "Pidgin", "twitter.com*", NULL, NULL, -1, NORM, NULL, NULL, "%s %b" },
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
4
dunst.c
4
dunst.c
@ -89,9 +89,10 @@ append(msg_queue_t *queue, msg_queue_t *new) {
|
||||
msg_queue_t *last;
|
||||
|
||||
|
||||
new->format = format;
|
||||
apply_rules(new);
|
||||
|
||||
new->msg = string_replace("%a", new->appname, strdup(format));
|
||||
new->msg = string_replace("%a", new->appname, strdup(new->format));
|
||||
new->msg = string_replace("%s", new->summary, new->msg);
|
||||
new->msg = string_replace("%i", new->icon, new->msg);
|
||||
new->msg = string_replace("%I", basename(new->icon), new->msg);
|
||||
@ -130,6 +131,7 @@ apply_rules(msg_queue_t *msg) {
|
||||
msg->urgency = rules[i].urgency != -1 ? rules[i].urgency : msg->urgency;
|
||||
msg->color_strings[ColFG] = rules[i].fg ? rules[i].fg : msg->color_strings[ColFG];
|
||||
msg->color_strings[ColBG] = rules[i].bg ? rules[i].bg : msg->color_strings[ColBG];
|
||||
msg->format = rules[i].format ? rules[i].format : msg->format;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
2
dunst.h
2
dunst.h
@ -19,6 +19,7 @@ typedef struct _rule_t {
|
||||
int urgency;
|
||||
char *fg;
|
||||
char *bg;
|
||||
const char *format;
|
||||
} rule_t;
|
||||
|
||||
typedef struct _msg_queue_t {
|
||||
@ -27,6 +28,7 @@ typedef struct _msg_queue_t {
|
||||
char *body;
|
||||
char *icon;
|
||||
char *msg;
|
||||
const char *format;
|
||||
struct _msg_queue_t *next;
|
||||
time_t start;
|
||||
int timeout;
|
||||
|
Loading…
x
Reference in New Issue
Block a user