diff options
author | Mikkel Oscar Lyderik <mikkeloscar@gmail.com> | 2016-01-06 17:01:45 +0100 |
---|---|---|
committer | Mikkel Oscar Lyderik <mikkeloscar@gmail.com> | 2016-01-08 03:03:55 +0100 |
commit | 6392abe35b32c66c642c25a7c6911021862d3413 (patch) | |
tree | 0949eee2d8dd8833478adc8f145f4e840f267359 /sway/handlers.c | |
parent | 32cd3f70eb4d9c55b65fa3cdd446c7a096cf4049 (diff) |
Implement IPC binding event (keyboard)
This implements the IPC binding event for keyboard bindings. It is
slightly different from the i3 implementation [1] since sway supports
more than one non-modifier key in a binding. Thus the json interface has
been changed from:
{
...
"symbol": "t",
...
}
to:
{
...
"symbols": [ "t" ],
...
}
[1] http://i3wm.org/docs/ipc.html#_binding_event
Diffstat (limited to 'sway/handlers.c')
-rw-r--r-- | sway/handlers.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sway/handlers.c b/sway/handlers.c index e0acebea..693e11eb 100644 --- a/sway/handlers.c +++ b/sway/handlers.c @@ -347,11 +347,14 @@ static bool handle_bindsym(struct sway_binding *binding) { } if (match) { + struct sway_binding *binding_copy = sway_binding_dup(binding); struct cmd_results *res = handle_command(binding->command); if (res->status != CMD_SUCCESS) { sway_log(L_ERROR, "Command '%s' failed: %s", res->input, res->error); } + ipc_event_binding_keyboard(binding_copy); free_cmd_results(res); + free_sway_binding(binding_copy); return true; } @@ -362,11 +365,14 @@ static bool handle_bindsym_release(struct sway_binding *binding) { if (binding->keys->length == 1) { xkb_keysym_t *key = binding->keys->items[0]; if (check_released_key(*key)) { + struct sway_binding *binding_copy = sway_binding_dup(binding); struct cmd_results *res = handle_command(binding->command); if (res->status != CMD_SUCCESS) { sway_log(L_ERROR, "Command '%s' failed: %s", res->input, res->error); } + ipc_event_binding_keyboard(binding_copy); free_cmd_results(res); + free_sway_binding(binding_copy); return true; } } |