Tahul/space-rabbit

Keyboard shortcut is swallowed when synthetic gesture posting fails

開放

#30 建立於 2026年8月7日

 (2 則留言) (0 個反應) (0 位負責人)Swift (1 個分叉)github user discovery
bughelp wanted

倉庫指標

星標
 (16 顆星)
PR 合併指標
 (平均合併 15小時 17分鐘) (30 天內合併 11 個 PR)

描述

Problem

The keyboard event tap swallows a matched Space shortcut even when posting the replacement DockSwipe fails.

In App/EventTap.swift, the left/right shortcut path calls postSwitchGesture(direction:) and records a switch only when it returns true, but then returns nil unconditionally. If event creation or posting fails, the original shortcut has already been swallowed and macOS never receives a native fallback.

Expected behavior

If the replacement gesture cannot be created or posted, the original key event should be passed through so macOS can perform its normal Space switch.

The expected control flow is:

  • Successful synthetic gesture: record the switch and swallow the original event.
  • Failed synthetic gesture: pass the original event through unchanged.

Why this matters

This is a fail-closed behavior at the input boundary: a rare allocation or posting failure can turn a recoverable instant-switch failure into a shortcut that appears to do nothing.

Suggested fix

Return the existing passthrough event when postSwitchGesture(direction:) returns false, while retaining the current edge-boundary behavior where the event is intentionally swallowed because there is no adjacent Space.

Verification

Exercise the failure path with a deterministic test seam or injected gesture-posting result. Confirm that the original key event reaches native macOS handling when synthetic posting fails.

貢獻者指南