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

@ -46,6 +46,7 @@
#endif
#include "drm-lease-v1-protocol.h"
#include "action.h"
#include "common/macros.h"
#include "common/scaled-scene-buffer.h"
#include "config/rcxml.h"
@ -160,9 +161,11 @@ handle_sigchld(int signal, void *data)
const char *signame;
switch (info.si_code) {
case CLD_EXITED:
wlr_log(info.si_status == 0 ? WLR_DEBUG : WLR_ERROR,
"spawned child %ld exited with %d",
(long)info.si_pid, info.si_status);
if (!action_check_prompt_result(info.si_pid, info.si_status)) {
wlr_log(info.si_status == 0 ? WLR_DEBUG : WLR_ERROR,
"spawned child %ld exited with %d",
(long)info.si_pid, info.si_status);
}
break;
case CLD_KILLED:
case CLD_DUMPED:
@ -171,6 +174,8 @@ handle_sigchld(int signal, void *data)
"spawned child %ld terminated with signal %d (%s)",
(long)info.si_pid, info.si_status,
signame ? signame : "unknown");
/* Allow cleanup of killed prompt */
action_check_prompt_result(info.si_pid, -info.si_status);
break;
default:
wlr_log(WLR_ERROR,