Skip to content

Commit

Permalink
Advertise icon capability iff icons are used
Browse files Browse the repository at this point in the history
  • Loading branch information
algmyr authored and emersion committed Feb 20, 2019
1 parent 200dab8 commit e3a69aa
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
12 changes: 11 additions & 1 deletion config.c
Expand Up @@ -94,9 +94,14 @@ void init_default_style(struct mako_style *style) {

style->border_size = 2;

#ifdef HAVE_ICONS
style->icons = true;
#else
style->icons = false;
#endif
style->max_icon_size = 64;


style->font = strdup("monospace 10");
style->markup = true;
style->format = strdup("<b>%s</b>\n%b");
Expand Down Expand Up @@ -302,7 +307,7 @@ bool apply_superset_style(
max(style->padding.bottom, target->padding.bottom);
target->padding.left = max(style->padding.left, target->padding.left);
target->border_size = max(style->border_size, target->border_size);
target->icons = style->max_icon_size || target->max_icon_size;
target->icons = style->icons || target->icons;
target->max_icon_size = max(style->max_icon_size, target->max_icon_size);
target->default_timeout =
max(style->default_timeout, target->default_timeout);
Expand Down Expand Up @@ -430,8 +435,13 @@ static bool apply_style_option(struct mako_style *style, const char *name,
} else if (strcmp(name, "progress-color") == 0) {
return spec->colors.progress = parse_mako_color(value, &style->colors.progress);
} else if (strcmp(name, "icons") == 0) {
#ifdef HAVE_ICONS
return spec->icons =
parse_boolean(value, &style->icons);
#else
fprintf(stderr, "Icon support not built in, ignoring icons setting.\n");
return true;
#endif
} else if (strcmp(name, "max-icon-size") == 0) {
return spec->max_icon_size =
parse_int(value, &style->max_icon_size);
Expand Down
7 changes: 7 additions & 0 deletions dbus/xdg.c
Expand Up @@ -52,6 +52,13 @@ static int handle_get_capabilities(sd_bus_message *msg, void *data,
}
}

if (state->config.superstyle.icons) {
ret = sd_bus_message_append(reply, "s", "icon-static");
if (ret < 0) {
return ret;
}
}

ret = sd_bus_message_close_container(reply);
if (ret < 0) {
return ret;
Expand Down

0 comments on commit e3a69aa

Please sign in to comment.