This commit is contained in:
Tobias Bengfort 2026-04-14 22:23:48 +01:00 committed by GitHub
commit 3b0d4e219d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 327 additions and 11 deletions

View file

@ -27,6 +27,7 @@
#include "menu/menu.h"
#include "output.h"
#include "output-virtual.h"
#include "permissions.h"
#include "regions.h"
#include "show-desktop.h"
#include "ssd.h"
@ -304,6 +305,9 @@ action_arg_from_xml_node(struct action *action, const char *nodename, const char
if (!strcmp(argument, "command") || !strcmp(argument, "execute")) {
action_arg_add_str(action, "command", content);
goto cleanup;
} else if (!strcmp(argument, "allow")) {
action->allowed_interfaces |= parse_privileged_interface(content);
goto cleanup;
}
break;
case ACTION_TYPE_MOVE_TO_EDGE:
@ -572,6 +576,7 @@ action_create(const char *action_name)
struct action *action = znew(*action);
action->type = action_type;
action->allowed_interfaces = 0;
wl_list_init(&action->args);
return action;
}
@ -1079,7 +1084,12 @@ run_action(struct view *view, struct action *action,
struct buf cmd = BUF_INIT;
buf_add(&cmd, action_get_str(action, "command", NULL));
buf_expand_tilde(&cmd);
spawn_async_no_shell(cmd.data);
int socket_fd = -1;
if (action->allowed_interfaces) {
socket_fd = permissions_context_create(
server.wl_display, action->allowed_interfaces);
}
spawn_async_no_shell(cmd.data, socket_fd);
buf_reset(&cmd);
break;
}