From f0f297a63a6724b3074a85bdc4e84ef3ed7de0b3 Mon Sep 17 00:00:00 2001 From: BillionClaw Date: Wed, 18 Mar 2026 20:04:56 +0800 Subject: [PATCH] fix(keyboard): forward unbound Cmd+Shift combinations to terminal Unbound Cmd+Shift+ combinations were being silently swallowed by the AppKit key-routing layer. The two-pass timestamp mechanism in performKeyEquivalent relied on AppKit to redispatch events, but AppKit never redispatches unbound keys that don't match menu items. Fix by forwarding unbound Command-modified keys directly to keyDown instead of returning false and hoping for redispatch. This ensures the kitty keyboard protocol receives the events. Fixes #1718 --- Sources/GhosttyTerminalView.swift | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/Sources/GhosttyTerminalView.swift b/Sources/GhosttyTerminalView.swift index ded6ac00679f..ef06b003d84d 100644 --- a/Sources/GhosttyTerminalView.swift +++ b/Sources/GhosttyTerminalView.swift @@ -4878,18 +4878,17 @@ class GhosttyNSView: NSView, NSUserInterfaceValidations { return false } - if let lastPerformKeyEvent { - self.lastPerformKeyEvent = nil - if lastPerformKeyEvent == event.timestamp { - equivalent = event.characters ?? "" - break - } - } - - lastPerformKeyEvent = event.timestamp - return false + // For unbound Command-modified keys (e.g., Cmd+Shift+K with no binding), + // forward directly to the terminal rather than relying on AppKit's redispatch. + // AppKit may drop the event if no menu item matches, preventing the key from + // reaching the terminal via the kitty keyboard protocol. + // See: https://github.com/manaflow-ai/cmux/issues/1718 + lastPerformKeyEvent = nil + keyDown(with: event) + return true } + // Handle \r and / cases by creating a modified event and forwarding to keyDown. let finalEvent = NSEvent.keyEvent( with: .keyDown, location: event.locationInWindow,