]> git.mdlowis.com Git - proto/labwc.git/commitdiff
menu: support <action name="Execute"> option <execute>
authorJohan Malm <jgm323@gmail.com>
Fri, 6 May 2022 20:55:46 +0000 (21:55 +0100)
committerJohan Malm <jgm323@gmail.com>
Fri, 6 May 2022 20:55:46 +0000 (21:55 +0100)
<exectue> is a deprecated name for <command>.
See: http://openbox.org/wiki/Help:Actions#Action_syntax

But some openbox3 menu generators still use it, for example
https://wiki.archlinux.org/title/xdg-menu - so let's support it for
backward compatibility.

docs/labwc-actions.5.scd
src/menu/menu.c

index ef65a52486d9a5b600edd7af128951261b3fd2bf..c36c731ea33d2c3b1fcbb5d806b4c18f6672b211 100644 (file)
@@ -12,7 +12,9 @@ Actions are used in keyboard bindings.
        Close top-most view.
 
 *<action name="Execute"><command>*
-       Execute command.
+       Execute command.  Note that in the interest of backward compatibility,
+       labwc supports <execute> as an alternative to <command> even though
+       openbox documentation states that it is deprecated.
 
 *<action name="Exit">*
        Exit labwc.
index fda73ceee3764ff5dda0914a7542b5df9d2a0489..846125a81cad222f234a872658763c46f8d7fdd7 100644 (file)
@@ -180,6 +180,13 @@ fill_item(char *nodename, char *content)
                        "nodename: '%s' content: '%s'", nodename, content);
        } else if (!strcmp(nodename, "command.action")) {
                current_item_action->arg = strdup(content);
+       } else if (!strcmp(nodename, "execute.action")) {
+               /*
+                * <action name="Execute"><execute>foo</execute></action>
+                * is deprecated, but we support it anyway for backward
+                * compatibility with old openbox-menu generators
+                */
+               current_item_action->arg = strdup(content);
        }
 }