Files
coucou/scripts/test-shortcuts.sh
LouisandClaude Sonnet 4.6 9fe8294ec7 Keyboard shortcuts (#205)
* Keyboard shortcuts

Carbon RegisterEventHotKey for 10 global shortcuts (no Accessibility
permission needed). Migrates the existing ⌘⇧N hotkey from NSEvent global
monitor. Adds Settings → Shortcuts section to configure and toggle each
shortcut, detect conflicts, and reset to defaults. Island-local shortcuts
(⌘→/←, ⌘1-9, ⌘↓/↑, ⌘O/E/↩/K/,/P) active when the island has focus.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(shortcuts): Escape when the island is key, real jump to terminal, card selection, General hotkey re-register, fly home

- Escape in local monitor: sendAction("cancelOperation:") so .onExitCommand
  on focused views (diff, Other… question) fires first; collapse only if nothing
  else consumed it.
- ⌃⌥T: guard on focusTask (error + annoyed if none), then use the same
  terminalBundleIds logic as the card's Open Terminal button; launch Terminal.app
  if no terminal is running.
- Card navigation: navigateCard uses ShortcutLogic.navigate + cardItemCount
  (AppState); openCardSelection posts .islandActivateCardSelection; GitHubDetailView
  handles it and opens the selected PR/repo row. Rows show a white-12% rounded
  overlay when selected. cardItemCount set on appear/disappear.
- Settings → General: Toggle + ShortcutRecorderButton now call
  HotKeyCenter.shared.reregister(.toggleIsland) on change, so the hotkey
  updates without relaunching the app.
- ⌃⌥D when Mochi is on desktop: calls flyHome() (animated fly + "peek" sound)
  instead of uninstall().
- ShortcutLogic.navigate(selection:delta:itemCount:) pure function + 9 new
  testCardNavigation cases.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-10-04 16:53:31 +02:00

9 lines
298 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "$0")/.."
TEST_DIR="$(mktemp -d "${TMPDIR:-/tmp}/coucou-shortcuts.XXXXXX")"
trap 'rm -rf "$TEST_DIR"' EXIT
swiftc NotchBuddy/Sources/App/ShortcutLogic.swift \
tests/ShortcutTests.swift -o "$TEST_DIR/shortcut-tests"
"$TEST_DIR/shortcut-tests"