From b72d524c5030c6586138826ba921230bfb394ddc Mon Sep 17 00:00:00 2001 From: John Lindgren Date: Sat, 4 Dec 2021 10:22:34 -0500 Subject: [PATCH] keyboard: Allow canceling the Alt-Tab switcher with Escape This is a standard feature in most window managers (OpenBox included) that allow window-switching via Alt-Tab. --- src/keyboard.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/keyboard.c b/src/keyboard.c index 91e1aeca..da4fcbba 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -119,6 +119,14 @@ handle_compositor_keybindings(struct wl_listener *listener, if (server->cycle_view) { damage_all_outputs(server); if (event->state == WL_KEYBOARD_KEY_STATE_PRESSED) { + for (int i = 0; i < nsyms; i++) { + if (syms[i] == XKB_KEY_Escape) { + /* cancel */ + server->cycle_view = NULL; + return true; + } + } + /* cycle to next */ bool backwards = modifiers & WLR_MODIFIER_SHIFT; /* ignore if this is a modifier key being pressed */