From 52d0f4d6ca68113c661d1ae7c1c42f7af30f5b96 Mon Sep 17 00:00:00 2001 From: "Anna (navi) Figueiredo Gomes" Date: Sun, 3 Mar 2024 21:56:50 +0100 Subject: action-binder-v1: update protocol Signed-off-by: Anna (navi) Figueiredo Gomes --- sway/action-binder-v1.c | 8 ++++---- sway/commands/action.c | 9 +++++++-- sway/server.c | 4 +--- 3 files changed, 12 insertions(+), 9 deletions(-) (limited to 'sway') diff --git a/sway/action-binder-v1.c b/sway/action-binder-v1.c index bf6ffef5..52452778 100644 --- a/sway/action-binder-v1.c +++ b/sway/action-binder-v1.c @@ -1,15 +1,15 @@ #include +#include "stringop.h" void action_binder_v1_bind(struct wl_listener *listener, void *data) { struct wlr_action_binder_v1_state *state = data; struct wlr_action_binding_v1 *binding = NULL, *tmp = NULL; wl_list_for_each_safe(binding, tmp, &state->bind_queue, link) { - wlr_action_binder_v1_bind(binding, ""); + char *msg = format_str("User defined trigger for %s:%s in the config file.", + binding->namespace, binding->name); + wlr_action_binding_v1_bind(binding, msg ? msg : ""); } } -void action_binder_v1_unbind(struct wl_listener *listener, void *data) { -} - void action_binder_v1_delete(struct wl_listener *listener, void *data) { } diff --git a/sway/commands/action.c b/sway/commands/action.c index 96cb3b59..877d5805 100644 --- a/sway/commands/action.c +++ b/sway/commands/action.c @@ -11,8 +11,13 @@ struct cmd_results *cmd_action(int argc, char **argv) { return error; } - wlr_action_binder_v1_trigger(server.action_binder, argv[0], argv[1], - EXT_ACTION_BINDING_V1_TRIGGER_TYPE_ONE_SHOT); + 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); } diff --git a/sway/server.c b/sway/server.c index 573a018b..10913b3f 100644 --- a/sway/server.c +++ b/sway/server.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -354,9 +355,6 @@ bool server_init(struct sway_server *server) { server->action_binder_bind.notify = action_binder_v1_bind; wl_signal_add(&server->action_binder->events.bind, &server->action_binder_bind); - server->action_binder_unbind.notify = action_binder_v1_unbind; - wl_signal_add(&server->action_binder->events.unbind, - &server->action_binder_unbind); server->action_binder_destroy.notify = action_binder_v1_delete; wl_signal_add(&server->action_binder->events.destroy, &server->action_binder_destroy); -- cgit v1.2.3