]> git.mdlowis.com Git - proto/labwc.git/commitdiff
Add <theme><fallbackAppIcon>
authortokyo4j <hrak1529@gmail.com>
Sun, 12 Jan 2025 07:52:37 +0000 (16:52 +0900)
committerConsolatis <35009135+Consolatis@users.noreply.github.com>
Sun, 26 Jan 2025 10:46:32 +0000 (11:46 +0100)
This commit adds <theme><fallbackAppIcon> that configures the icon name
to be used when lookups for an application icon is failed. Its default
value is set as 'labwc' which shows our labwc logo.

docs/labwc-config.5.scd
docs/rc.xml.all
include/config/rcxml.h
src/common/scaled-icon-buffer.c
src/config/rcxml.c

index d739b54969677c025eda8734571f17f370287f66..1c160a45f2ffab7c58404fe201b8fdb0429a717f 100644 (file)
@@ -483,6 +483,12 @@ extending outward from the snapped edge.
 *<theme><icon>*
        The name of the icon theme to use. It is not set by default.
 
+*<theme><fallbackAppIcon>*
+       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'.
+
 *<theme><titlebar><layout>*
        Selection and order of buttons in a window's titlebar.
        The following identifiers can be used, each only once:
index 4c872e243d7d95ef53aa357524143d4db0f99a3c..16f5c212b75fafce5455e4776fcadcbb49ad3950 100644 (file)
@@ -30,6 +30,7 @@
   <theme>
     <name></name>
     <icon></icon>
+    <fallbackAppIcon>labwc</fallbackAppIcon>
     <titlebar>
       <layout>icon:iconify,max,close</layout>
       <showTitle>yes</showTitle>
index 8475738615f182dfccc2e0590008c8d961fb5019..9aa6c9bab89b95c9719e93ac76cad9ca29e3e6b7 100644 (file)
@@ -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;
index 1ecc12b23218f3d9c3f5b138eebc0739b5bf6e68..cc4d631713573484ae4e9fda806b7b2d96cdcc7f 100644 (file)
@@ -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) {
index 21ce2f8aa17b96608fadf3a1c8803376f68afc4d..0dfdc6048f6317b7a0e5773d62eed8bfc510ae8d 100644 (file)
@@ -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);