Commit graph

22 commits

Author SHA1 Message Date
Consolatis
fba73a0036 action: add support for <prompt> in 'If' actions
...and allow If Action without activator view.

For example:

    <action name="If">
      <prompt message="Toggle maximize?"/>
      <then>
        <action name="ToggleMaximize" />
      </then>
    </action>

Also revert the change in b9c84f9 that <else> branch is always taken when
no window is focused.

Co-Authored-by: johanmalm
Co-Authored-by: tokyo4j
2025-08-09 10:44:03 +01:00
tokyo4j
fb5e85f40f menu: remove ShowMenu action from menu items
Previous commits fixed some unexpected behaviors when ShowMenu action is
executed from menu items, but that was still prone to bugs because when
calling actions_run(), we allow an inconsistent state where all menus are
closed but pipemenus must not be destroyed.

So this commit simply removes ShowMenu actions from menu items on
initialization.
2025-02-07 17:58:55 +01:00
tokyo4j
25f5cdd3a6 Refactor the logic of placing client-menu with ShowMenu action
Before this commit, we assumed `ShowMenu` action is not bound to any
buttons other than window menu button and always place the client-menu
under the window-menu button when atCursor="no". Also, it was going to be
difficult to distinguish whether the action is executed from the window
menu button or the window icon, which will be added soon.

This commit fixes it to open the menu under the actually-clicked button by
passing `cursor_context` to `actions_run()`, with some refactoring:
- `seat->pressed.resize_edges` is removed and it's calculated from the
  cursor position and `seat->pressed.type` just before running Resize
  action. This slightly changes the existing logic to determine the
  resizing edges with Alt-Right + Drag mousebinding, but
  `seat->pressed.type` is still stored on button press so it doesn't bring
  back the issue #543.
- `seat->pressed.toplevel` is removed and `get_toplevel()` in
  `update_pressed_surface()` may be called more often, but its overhead
  will be negligible.
2024-09-21 18:07:34 +01:00
Hiroaki Yamamoto
d64e3915a3
Fix some header includes detected by clangd
There were some missing headers like <stddef.h> for `NULL`, <wayland-util.h>
for `wl_link` and <stdbool.h> for `true`/`false`.

Also this commit fixes that `labwc.h` and `ime.h` included each other.
2024-04-21 21:58:57 +02:00
Consus
22e3be40e5 action: add If and ForEach actions
Add If and ForEach actions as described in OpenBox specification.

Limitations:

- If and ForEach cannot contain nested If and ForEach.
2023-10-01 14:17:29 +01:00
Consolatis
43db75f43c Restore SnapToEdge and MoveToEdge default keybinds
When adding the fallback keybinds we add them as string but expect them being an int.
This commit fixes that by using the same parsing routines that are used when parsing
user supplied configuration.

Fixes 1ee8715d57
actions: use enum for _ToEdge action
2023-08-06 10:37:36 +02:00
Consolatis
65b441a0ba config: validate keybind, mousebind and menu actions 2023-07-05 22:20:18 +02:00
Consolatis
665d31c1c7 src/action.c: add action_is_valid() 2023-07-05 22:20:18 +02:00
Consolatis
b05b92bb27 src/action.c: enforce action arg->key being set 2023-07-05 22:20:18 +02:00
Tomi Ollila
7ad5200f2e includes: identifier consistency in include guards
Made all header files to have LABWC_ prefix in include guard identifers.

Converted from __LABWC_ in 35 include/ files.
Converted from __LAB_ in 5 include/ files.
Added LABWC prefix to 3 include/ files.
Added include guards to 3 include/ files.

The double underscores were removed since according to C standard
those "are always reserved for any use".
2023-05-13 22:29:21 +01:00
Johan Malm
440f7bd760 action: make action_arg_add_bool() static 2023-04-26 15:11:31 +01:00
Johan Malm
33b98b19aa action: support SendToDesktop 'follow' option
Make follow 'true' by default as per Openbox 3.6 specification.
Note: this is an interface change.

Fixes: issue #841
2023-03-26 19:52:50 +02:00
Consolatis
c33a404dc1 Add ToggleKeybinds action
This can be used to better control Virtual Machines, VNC clients, nested
compositors or similar. All keybinds other than ToggleKeybinds itself are
disabled when first called, a 2nd call will restore handling of all keybinds.

Fixes #738
Fixes #810
2023-03-04 13:24:59 +00:00
Consolatis
7cc80b7a99 src/action.c: Provide generic parsing of XML action arguments
.. and use it within src/config/rcxml.c and src/menu/menu.c.

This fixes being unable to use the `direction` argument in menu entries.

Reported-by: mahk via IRC
2022-12-10 19:55:53 +00:00
John Lindgren
4906d1833a action: Inline private/action.h into action.c
There is no need for a header since the types defined in it are
used only in action.c.
2022-11-25 22:32:22 +00:00
Johan Malm
e45e2c7e60 Fix coding style 2022-11-03 23:01:52 +01:00
Consolatis
9b49f19a73 src/action.c: Convert action->arg to a list of action_arg
In preperation for Actions that require multiple arguments
2022-07-04 16:19:28 +01:00
Consolatis
953e8a4f9d [style] rename action() to actions_run() 2022-02-24 21:17:51 +00:00
Consolatis
f0a3f365e5 Centralize freeing of action lists
Reduces some code duplication and makes it easier to extend struct action
2022-01-23 10:36:04 -05:00
Johan Malm
3c92cc4dd0 Move action() prototype from labwc.h to action.h 2022-01-05 21:27:47 +00:00
Johan Malm
3bd65c3a20 action.{c,h}: fix coding style 2022-01-05 21:23:01 +00:00
Consolatis
0b45cce648 Rewrite action handling to allow multiple actions at once 2022-01-05 16:22:41 +00:00