From 6f67949c9baa2cc7750dc8978f5ee2a4f2974323 Mon Sep 17 00:00:00 2001 From: Tyler Hebenstreit Date: Wed, 1 Jul 2026 11:26:04 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20Consume=20unmatched=20keys=20whi?= =?UTF-8?q?le=20Loop=20is=20open=20and=20the=20trigger=20is=20held?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When Loop is open and the trigger key is still held (mid-chord), a keyDown that doesn't match any bound action fell through to `.forward`, leaking the key to the focused app (e.g. typing "2" repeatedly during a `trigger+2+arrow` chord that isn't bound). Consume unmatched keyDowns while Loop is open and the trigger is held; releases and post-trigger keys still forward. --- Loop/Core/Observers/KeybindTrigger.swift | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Loop/Core/Observers/KeybindTrigger.swift b/Loop/Core/Observers/KeybindTrigger.swift index 4bfb129f..ffdffa84 100644 --- a/Loop/Core/Observers/KeybindTrigger.swift +++ b/Loop/Core/Observers/KeybindTrigger.swift @@ -217,7 +217,15 @@ final class KeybindTrigger { } } - // If this wasn't a valid keybind, return false, which will then forward the key event to the frontmost app + // While Loop is open and the trigger is still held, the user is mid-chord: consume any + // unmatched keyDown so stray characters (e.g. the "2" in a `trigger+2+arrow` chord that + // isn't bound to an action) don't leak into the focused app. Gated on `containsTrigger` + // and `.keyDown` so key releases — and keys typed after releasing the trigger — still forward. + if checkIfLoopOpen(), containsTrigger, type == .keyDown { + return .consume + } + + // If this wasn't a valid keybind, forward the key event to the frontmost app. return .forward }