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.

贡献者指南