diff --git a/docs/labwc-config.5.scd b/docs/labwc-config.5.scd index d739b549..1c160a45 100644 --- a/docs/labwc-config.5.scd +++ b/docs/labwc-config.5.scd @@ -483,6 +483,12 @@ extending outward from the snapped edge. ** The name of the icon theme to use. It is not set by default. +** + The name of the icon to use as a fallback when the application icon + (e.g. window icon in the titlebar) is not available. The name follows + the ones specified in "Icon=" entries in desktop files. + Default is 'labwc'. + ** Selection and order of buttons in a window's titlebar. The following identifiers can be used, each only once: diff --git a/docs/rc.xml.all b/docs/rc.xml.all index 4c872e24..16f5c212 100644 --- a/docs/rc.xml.all +++ b/docs/rc.xml.all @@ -30,6 +30,7 @@ + labwc icon:iconify,max,close yes diff --git a/include/config/rcxml.h b/include/config/rcxml.h index 84757386..9aa6c9ba 100644 --- a/include/config/rcxml.h +++ b/include/config/rcxml.h @@ -84,6 +84,7 @@ struct rcxml { /* theme */ char *theme_name; char *icon_theme_name; + char *fallback_app_icon_name; struct wl_list title_buttons_left; struct wl_list title_buttons_right; int corner_radius; diff --git a/src/common/scaled-icon-buffer.c b/src/common/scaled-icon-buffer.c index 1ecc12b2..cc4d6317 100644 --- a/src/common/scaled-icon-buffer.c +++ b/src/common/scaled-icon-buffer.c @@ -27,6 +27,10 @@ _create_buffer(struct scaled_scene_buffer *scaled_buffer, double scale) } else if (self->app_id) { img = desktop_entry_load_icon_from_app_id(self->server, self->app_id, icon_size, scale); + if (!img) { + img = desktop_entry_load_icon(self->server, + rc.fallback_app_icon_name, icon_size, scale); + } } if (!img) { diff --git a/src/config/rcxml.c b/src/config/rcxml.c index 21ce2f8a..0dfdc604 100644 --- a/src/config/rcxml.c +++ b/src/config/rcxml.c @@ -1073,6 +1073,8 @@ entry(xmlNode *node, char *nodename, char *content) xstrdup_replace(rc.theme_name, content); } else if (!strcmp(nodename, "icon.theme")) { xstrdup_replace(rc.icon_theme_name, content); + } else if (!strcasecmp(nodename, "fallbackAppIcon.theme")) { + xstrdup_replace(rc.fallback_app_icon_name, content); } else if (!strcasecmp(nodename, "layout.titlebar.theme")) { fill_title_layout(content); } else if (!strcasecmp(nodename, "showTitle.titlebar.theme")) { @@ -1677,6 +1679,10 @@ post_processing(void) load_default_mouse_bindings(); } + if (!rc.fallback_app_icon_name) { + rc.fallback_app_icon_name = xstrdup("labwc"); + } + if (!rc.title_layout_loaded) { #if HAVE_LIBSFDO fill_title_layout("icon:iconify,max,close"); @@ -1928,6 +1934,7 @@ rcxml_finish(void) zfree(rc.font_osd.name); zfree(rc.theme_name); zfree(rc.icon_theme_name); + zfree(rc.fallback_app_icon_name); zfree(rc.workspace_config.prefix); zfree(rc.tablet.output_name);