aboutsummaryrefslogtreecommitdiff
path: root/sway/commands/action.c
blob: 877d5805b9dd82e57f1f97b6280ab8df83056135 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include "log.h"
#include <wlr/types/wlr_action_binder_v1.h>
#include "ext-action-binder-v1-protocol.h"
#include "sway/commands.h"
#include "sway/server.h"
#include "sway/input/input-manager.h"

struct cmd_results *cmd_action(int argc, char **argv) {
	struct cmd_results *error = NULL;
	if ((error = checkarg(argc, "action", EXPECTED_EQUAL_TO, 2))) {
		return error;
	}

	struct wlr_action_binder_v1_state *state = NULL;
	struct wlr_action_binding_v1 *binding = NULL;
	wl_list_for_each(state, &server.action_binder->states, link) {
		wl_list_for_each(binding, &state->binds, link) {
			wlr_action_binding_v1_trigger(binding, EXT_ACTION_BINDING_V1_TRIGGER_TYPE_ONE_SHOT, 0);
		}
	}

	return cmd_results_new(CMD_SUCCESS, NULL);
}