]> git.mdlowis.com Git - proto/labwc.git/commitdiff
keyboard: Allow canceling the Alt-Tab switcher with Escape
authorJohn Lindgren <john@jlindgren.net>
Sat, 4 Dec 2021 15:22:34 +0000 (10:22 -0500)
committerARDiDo <90479315+ARDiDo@users.noreply.github.com>
Sat, 4 Dec 2021 17:24:47 +0000 (12:24 -0500)
This is a standard feature in most window managers (OpenBox
included) that allow window-switching via Alt-Tab.

src/keyboard.c

index 91e1aeca5c23e14ce25aac512b5201a3ea2c07a7..da4fcbbac95ae7087a9bc858756c80fa1087e073 100644 (file)
@@ -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 */