mirror of
https://github.com/labwc/labwc.git
synced 2025-10-29 05:40:24 -04:00
menu: support pipe menus
See labwc-menu(5) for usage. Co-authored-by: @Consolatis
This commit is contained in:
parent
e5488fefcb
commit
f3b68b8fb5
3 changed files with 506 additions and 65 deletions
|
|
@ -33,16 +33,21 @@ The menu file must be entirely enclosed within <openbox_menu> and
|
|||
...some content...
|
||||
</menu>
|
||||
|
||||
<!-- Pipemenu -->
|
||||
<menu id="" label="" execute="COMMAND"/>
|
||||
|
||||
</menu>
|
||||
```
|
||||
|
||||
*menu.id*
|
||||
Each menu must be given an id, which is a unique identifier of the menu.
|
||||
This id is used to refer to the menu in a ShowMenu action.
|
||||
Default identifiers are "client-menu" for the titlebar context menu and
|
||||
"root-menu" for the root window context menu.
|
||||
Available localisation for the default "client-menu" is
|
||||
only shown if no "client-menu" is present in menu.xml.
|
||||
*menu.id* (when at toplevel)
|
||||
Define a menu tree. Each menu must be given an id, which is a unique
|
||||
identifier of the menu. This id is used to refer to the menu in a
|
||||
ShowMenu action. Default identifiers are
|
||||
- "root-menu" for the root window context menu
|
||||
- "client-menu" for a window's titlebar context menu
|
||||
|
||||
*menu.id* (when nested under other *<menu>* element)
|
||||
Link to a submenu defined elsewhere (by a *<menu id="">* at toplevel)
|
||||
|
||||
*menu.label*
|
||||
The title of the menu, shown in its parent. A label must be given when
|
||||
|
|
@ -58,6 +63,48 @@ The menu file must be entirely enclosed within <openbox_menu> and
|
|||
*menu.separator*
|
||||
Horizontal line.
|
||||
|
||||
*menu.execute*
|
||||
Command to execute for pipe menu. See details below.
|
||||
|
||||
# PIPE MENUS
|
||||
|
||||
Pipe menus are menus generated dynamically based on output of scripts or
|
||||
binaries. They are so-called because the output of the executable is piped to
|
||||
the labwc menu.
|
||||
|
||||
For any *<menu id="" label="" execute="COMMAND"/>* entry in menu.xml, the
|
||||
COMMAND will be executed the first time the item is selected (for example by
|
||||
cursor or keyboard input). The XML output of the command will be parsed and
|
||||
shown as a submenu. The content of pipemenus is cached until the whole menu
|
||||
(not just the pipemenu) is closed.
|
||||
|
||||
The content of the output must be entirely enclosed within *<openbox_pipe_menu>*
|
||||
tags. Inside these, menus are specified in the same way as static (normal)
|
||||
menus, for example:
|
||||
|
||||
```
|
||||
<openbox_pipe_menu>
|
||||
<item label="Terminal">
|
||||
<action name="Execute" command="xterm"/>
|
||||
</item>
|
||||
</openbox_pipe_menu>
|
||||
```
|
||||
|
||||
Inline submenus and nested pipemenus are supported.
|
||||
|
||||
Note that it is the responsibility of the pipemenu executable to ensure that
|
||||
ID attributes are unique. Duplicates are ignored.
|
||||
|
||||
When writing pipe menu scripts, make sure to escape XML special characters such
|
||||
as "&" ("&"), "<" ("<"), and ">" (">").
|
||||
|
||||
|
||||
# LOCALISATION
|
||||
|
||||
Available localisation for the default "client-menu" is only shown if no
|
||||
"client-menu" is present in menu.xml. Any menu definition in menu.xml is
|
||||
interpreted as a user-override.
|
||||
|
||||
# SEE ALSO
|
||||
|
||||
labwc(1), labwc-action(5), labwc-config(5), labwc-theme(5)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue