Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions config.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ void init_default_style(struct mako_style *style) {
style->actions = true;
style->default_timeout = 0;
style->ignore_timeout = false;
style->ignore_replace = false;

style->colors.background = 0x285577FF;
style->colors.text = 0xFFFFFFFF;
Expand Down Expand Up @@ -311,6 +312,11 @@ bool apply_style(struct mako_style *target, const struct mako_style *style) {
target->spec.ignore_timeout = true;
}

if (style->spec.ignore_replace) {
target->ignore_replace = style->ignore_replace;
target->spec.ignore_replace = true;
}

if (style->spec.colors.background) {
target->colors.background = style->colors.background;
target->spec.colors.background = true;
Expand Down Expand Up @@ -642,6 +648,9 @@ static bool apply_style_option(struct mako_style *style, const char *name,
} else if (strcmp(name, "ignore-timeout") == 0) {
return spec->ignore_timeout =
parse_boolean(value, &style->ignore_timeout);
} else if (strcmp(name, "ignore-replace") == 0) {
return spec->ignore_replace =
parse_boolean(value, &style->ignore_replace);
} else if (strcmp(name, "group-by") == 0) {
return spec->group_criteria_spec =
parse_criteria_spec(value, &style->group_criteria_spec);
Expand Down Expand Up @@ -921,6 +930,7 @@ int parse_config_arguments(struct mako_config *config, int argc, char **argv) {
{"history", required_argument, 0, 0},
{"default-timeout", required_argument, 0, 0},
{"ignore-timeout", required_argument, 0, 0},
{"ignore-replace", required_argument, 0, 0},
{"output", required_argument, 0, 0},
{"layer", required_argument, 0, 0},
{"anchor", required_argument, 0, 0},
Expand Down
7 changes: 5 additions & 2 deletions dbus/xdg.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ static int handle_notify(sd_bus_message *msg, void *data,
struct mako_notification *notif = NULL;
if (replaces_id > 0) {
notif = get_notification(state, replaces_id);
if (notif && notif->style.ignore_replace) {
notif = NULL;
}
}

if (notif) {
Expand Down Expand Up @@ -362,7 +365,7 @@ static int handle_notify(sd_bus_message *msg, void *data,
if (notif->tag) {
// Find and replace the existing notfication with a matching tag
struct mako_notification *replace_notif = get_tagged_notification(state, notif->tag, app_name);
if (replace_notif) {
if (replace_notif && !replace_notif->style.ignore_replace) {
notif->id = replace_notif->id;
wl_list_insert(&replace_notif->link, &notif->link);
destroy_notification(replace_notif);
Expand Down Expand Up @@ -446,7 +449,7 @@ static int handle_close_notification(sd_bus_message *msg, void *data,

// TODO: check client
struct mako_notification *notif = get_notification(state, id);
if (notif) {
if (notif && !notif->style.ignore_replace) {
struct mako_surface *surface = notif->surface;
close_notification(notif, MAKO_NOTIFICATION_CLOSE_REQUEST, true);
set_dirty(surface);
Expand Down
3 changes: 2 additions & 1 deletion include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ enum mako_icon_location {
// structs are also mirrored.
struct mako_style_spec {
bool width, height, outer_margin, margin, padding, border_size, border_radius, font,
markup, format, text_alignment, actions, default_timeout, ignore_timeout,
markup, format, text_alignment, actions, default_timeout, ignore_timeout, ignore_replace,
icons, max_icon_size, icon_path, icon_border_radius, group_criteria_spec, invisible, history,
icon_location, max_visible, layer, output, anchor;
struct {
Expand Down Expand Up @@ -77,6 +77,7 @@ struct mako_style {
bool actions;
int default_timeout; // in ms
bool ignore_timeout;
bool ignore_replace;

struct {
uint32_t background;
Expand Down