labwc-action(5): describe If action <prompt>

This commit is contained in:
Johan Malm 2025-06-24 20:44:32 +01:00 committed by Johan Malm
parent c63d35c942
commit 8a5a04cc1a
2 changed files with 31 additions and 0 deletions

View file

@ -423,6 +423,7 @@ Actions that execute other actions. Used in keyboard/mouse bindings.
``` ```
<action name="If"> <action name="If">
<query/> <query/>
<prompt message=""/>
<then><action/></then> <then><action/></then>
<else><action/></else> <else><action/></else>
</action> </action>
@ -494,6 +495,26 @@ Actions that execute other actions. Used in keyboard/mouse bindings.
This argument is optional. This argument is optional.
*prompt*
Display a yes/no prompt dialog (labnag by default). If 'yes' is
selected, the *then* branch will be taken; and similarly with
'no' and *else*. This argument is optional. Note that the syntax
is different to that of Openbox where a prompt element is not
tied to If-actions but would just be a child of the downstream
action. The reason for this difference is increased flexibility
and functionality gained by optionally using an *else* branch.
```
<keybind key="W-q">
<action name="If">
<prompt message="Quit?"/>
<then>
<action name="Exit"/>
</then>
</action>
</keybind>
```
*then* *then*
A list of actions to be executed if the window matches any A list of actions to be executed if the window matches any
query. This argument is optional. query. This argument is optional.

View file

@ -65,6 +65,16 @@
<item label="Exit"> <item label="Exit">
<action name="Exit" /> <action name="Exit" />
</item> </item>
<!--
# A prompt can be used as follows:
<item label="Exit">
<action name="If"/>
<prompt message="Do you really want to exit the compositor?"/>
<then>
<action name="Exit"/>
</then>
</item>
-->
</menu> </menu>
<menu id="some-custom-menu"> <menu id="some-custom-menu">