]> git.mdlowis.com Git - proto/labwc.git/commitdiff
src/menu: add global config for menu.showIcons
authorConsolatis <35009135+Consolatis@users.noreply.github.com>
Mon, 27 Jan 2025 16:19:20 +0000 (17:19 +0100)
committerJohan Malm <johanmalm@users.noreply.github.com>
Sun, 2 Feb 2025 15:05:37 +0000 (15:05 +0000)
docs/labwc-config.5.scd
docs/rc.xml.all
include/config/rcxml.h
src/config/rcxml.c
src/menu/menu.c

index 8742dd6aaec7be0caaa859308d0d883088fc86f9..23b5df3765cfa95f78ab00ace4ab2b8b5028dcd5 100644 (file)
@@ -1121,6 +1121,7 @@ situation.
 ```
 <menu>
   <ignoreButtonReleasePeriod>250</ignoreButtonReleasePeriod>
+  <showIcons>yes</showIcons>
 </menu>
 ```
 
@@ -1134,6 +1135,11 @@ situation.
        option has been exposed for unusual use-cases. It is equivalent to
        Openbox's `<hideDelay>`. Default is 250 ms.
 
+*<menu><showIcons>*
+       Show menu icons based on the `icon` attribute of menu label elements.
+       Default is yes. Requires libsfdo. If labwc is built without it, no
+       icons will be shown.
+
 ## MAGNIFIER
 
 ```
index 16f5c212b75fafce5455e4776fcadcbb49ad3950..8ea2710bf276d516b5d04ef512309c1c999e37f2 100644 (file)
 
   <menu>
     <ignoreButtonReleasePeriod>250</ignoreButtonReleasePeriod>
+    <showIcons>yes</showIcons>
   </menu>
 
   <!--
index 9aa6c9bab89b95c9719e93ac76cad9ca29e3e6b7..208b73e0d005d430c411a6ccc29f32535d5b581c 100644 (file)
@@ -175,6 +175,7 @@ struct rcxml {
 
        /* Menu */
        unsigned int menu_ignore_button_release_period;
+       bool menu_show_icons;
 
        /* Magnifier */
        int mag_width;
index 90fcfe152e05715f27fca687fbfd7cebcfde0a3e..4a60b73b0486e71c6d373455b7bdb6d3b34ee446 100644 (file)
@@ -1252,6 +1252,8 @@ entry(xmlNode *node, char *nodename, char *content)
                        tablet_get_dbl_if_positive(content, "relativeMotionSensitivity");
        } else if (!strcasecmp(nodename, "ignoreButtonReleasePeriod.menu")) {
                rc.menu_ignore_button_release_period = atoi(content);
+       } else if (!strcasecmp(nodename, "showIcons.menu")) {
+               set_bool(content, &rc.menu_show_icons);
        } else if (!strcasecmp(nodename, "width.magnifier")) {
                rc.mag_width = atoi(content);
        } else if (!strcasecmp(nodename, "height.magnifier")) {
@@ -1497,6 +1499,7 @@ rcxml_init(void)
        rc.workspace_config.min_nr_workspaces = 1;
 
        rc.menu_ignore_button_release_period = 250;
+       rc.menu_show_icons = true;
 
        rc.mag_width = 400;
        rc.mag_height = 400;
index 554c369cffed3c3dc0d6fb4f3b785456c6481245..a774842c624b891879f9a8749a178baa2ba7cee8 100644 (file)
@@ -459,8 +459,7 @@ fill_item(char *nodename, char *content)
                        "nodename: '%s' content: '%s'", nodename, content);
        } else if (!strcmp(nodename, "icon")) {
 #if HAVE_LIBSFDO
-               // TODO: add some rc.menu_icons bool
-               if (true && !string_null_or_empty(content)) {
+               if (rc.menu_show_icons && !string_null_or_empty(content)) {
                        xstrdup_replace(current_item->icon_name, content);
                        current_menu->has_icons = true;
                }