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
This commit is contained in:
Consolatis 2024-12-20 10:14:32 +01:00 committed by Johan Malm
parent 32e308b5d5
commit fba73a0036
3 changed files with 135 additions and 14 deletions

View file

@ -3,6 +3,7 @@
#define LABWC_ACTION_H
#include <stdbool.h>
#include <sys/types.h>
#include <wayland-util.h>
struct view;
@ -47,6 +48,8 @@ bool actions_contain_toggle_keybinds(struct wl_list *action_list);
void actions_run(struct view *activator, struct server *server,
struct wl_list *actions, struct cursor_context *ctx);
bool action_check_prompt_result(pid_t pid, int exit_code);
void action_free(struct action *action);
void action_list_free(struct wl_list *action_list);