Introduce default icon setting
This commit is contained in:
parent
a02ab4cf70
commit
d0662e78ec
@ -11,6 +11,7 @@ char *lowfgcolor = "#000000";
|
|||||||
char *format = "%s %b"; /* default format */
|
char *format = "%s %b"; /* default format */
|
||||||
|
|
||||||
int timeouts[] = { 10, 10, 0 }; /* low, normal, critical */
|
int timeouts[] = { 10, 10, 0 }; /* low, normal, critical */
|
||||||
|
char *icons[] = { "info", "info", "emblem-important" }; /* low, normal, critical */
|
||||||
|
|
||||||
unsigned int transparency = 0; /* transparency */
|
unsigned int transparency = 0; /* transparency */
|
||||||
char *geom = "0x0"; /* geometry */
|
char *geom = "0x0"; /* geometry */
|
||||||
|
@ -383,6 +383,14 @@ int notification_init(notification * n, int id)
|
|||||||
n->timeout == -1 ? settings.timeouts[n->urgency] : n->timeout;
|
n->timeout == -1 ? settings.timeouts[n->urgency] : n->timeout;
|
||||||
n->start = 0;
|
n->start = 0;
|
||||||
|
|
||||||
|
if (n->icon == NULL) {
|
||||||
|
n->icon = settings.icons[n->urgency];
|
||||||
|
}
|
||||||
|
else if (strlen(n->icon) <= 0) {
|
||||||
|
free(n->icon);
|
||||||
|
n->icon = settings.icons[n->urgency];
|
||||||
|
}
|
||||||
|
|
||||||
n->timestamp = time(NULL);
|
n->timestamp = time(NULL);
|
||||||
|
|
||||||
n->redisplayed = false;
|
n->redisplayed = false;
|
||||||
|
12
settings.c
12
settings.c
@ -231,6 +231,9 @@ void load_settings(char *cmdline_config_path)
|
|||||||
settings.timeouts[LOW] =
|
settings.timeouts[LOW] =
|
||||||
option_get_int("urgency_low", "timeout", "-lto", timeouts[LOW],
|
option_get_int("urgency_low", "timeout", "-lto", timeouts[LOW],
|
||||||
"Timeout for notifications with low urgency");
|
"Timeout for notifications with low urgency");
|
||||||
|
settings.icons[LOW] =
|
||||||
|
option_get_string("urgency_low", "icon", "-li", icons[LOW],
|
||||||
|
"Icon for notifications with low urgency");
|
||||||
settings.normbgcolor =
|
settings.normbgcolor =
|
||||||
option_get_string("urgency_normal", "background", "-nb",
|
option_get_string("urgency_normal", "background", "-nb",
|
||||||
normbgcolor,
|
normbgcolor,
|
||||||
@ -242,6 +245,9 @@ void load_settings(char *cmdline_config_path)
|
|||||||
settings.timeouts[NORM] =
|
settings.timeouts[NORM] =
|
||||||
option_get_int("urgency_normal", "timeout", "-nto", timeouts[NORM],
|
option_get_int("urgency_normal", "timeout", "-nto", timeouts[NORM],
|
||||||
"Timeout for notifications with normal urgency");
|
"Timeout for notifications with normal urgency");
|
||||||
|
settings.icons[NORM] =
|
||||||
|
option_get_string("urgency_normal", "icon", "-ni", icons[NORM],
|
||||||
|
"Icon for notifications with normal urgency");
|
||||||
settings.critbgcolor =
|
settings.critbgcolor =
|
||||||
option_get_string("urgency_critical", "background", "-cb",
|
option_get_string("urgency_critical", "background", "-cb",
|
||||||
critbgcolor,
|
critbgcolor,
|
||||||
@ -251,9 +257,11 @@ void load_settings(char *cmdline_config_path)
|
|||||||
critfgcolor,
|
critfgcolor,
|
||||||
"Foreground color for notifications with ciritical urgency");
|
"Foreground color for notifications with ciritical urgency");
|
||||||
settings.timeouts[CRIT] =
|
settings.timeouts[CRIT] =
|
||||||
option_get_int("urgency_critical", "timeout", "-cto",
|
option_get_int("urgency_critical", "timeout", "-cto", timeouts[CRIT],
|
||||||
timeouts[CRIT],
|
|
||||||
"Timeout for notifications with critical urgency");
|
"Timeout for notifications with critical urgency");
|
||||||
|
settings.icons[CRIT] =
|
||||||
|
option_get_string("urgency_critical", "icon", "-ci", icons[CRIT],
|
||||||
|
"Icon for notifications with critical urgency");
|
||||||
|
|
||||||
settings.close_ks.str =
|
settings.close_ks.str =
|
||||||
option_get_string("shortcuts", "close", "-key", close_ks.str,
|
option_get_string("shortcuts", "close", "-key", close_ks.str,
|
||||||
|
@ -14,6 +14,7 @@ typedef struct _settings {
|
|||||||
char *lowfgcolor;
|
char *lowfgcolor;
|
||||||
char *format;
|
char *format;
|
||||||
int timeouts[3];
|
int timeouts[3];
|
||||||
|
char *icons[3];
|
||||||
unsigned int transparency;
|
unsigned int transparency;
|
||||||
char *geom;
|
char *geom;
|
||||||
int shrink;
|
int shrink;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user