Skip to content

fix: respect Ctrl as the primary modifier on Windows/Linux#92

Open
mthorme wants to merge 2 commits into
debuglebowski:mainfrom
mthorme:fix/windows-shortcuts
Open

fix: respect Ctrl as the primary modifier on Windows/Linux#92
mthorme wants to merge 2 commits into
debuglebowski:mainfrom
mthorme:fix/windows-shortcuts

Conversation

@mthorme
Copy link
Copy Markdown

@mthorme mthorme commented May 23, 2026

Problem

On Windows (and Linux), several interactions were dead because the handlers gated on event.metaKey directly. Off macOS, metaKey is the Super/Win key, not Ctrl — so the Cmd-equivalent actions never fired, and a number of on-screen hints still showed .

The shortcut registry is already cross-platform (matchesShortcut maps mod → Ctrl off macOS). The bugs were all in raw handlers that bypass it.

What this fixes

  • Create Task: Ctrl+Enter / Ctrl+Shift+Enter now create the task (was metaKey-only).
  • Terminal: Ctrl+Click opens URLs and file paths (browser / editor / external), matching Cmd+Click on macOS.
  • Kanban board & list: Ctrl+Click opens a task in the background.
  • Hints: hardcoded strings now render Ctrl off macOS via formatKeysForDisplay (Create button, terminal hover hints). The terminal context menu now shows the real Ctrl+Shift+C / Ctrl+Shift+V copy-paste bindings on Windows/Linux instead of ⌘C / ⌘V.

Approach

Add a small isPrimaryModifier(e) helper to @slayzone/shortcuts (re-exported from @slayzone/ui) that returns metaKey on macOS and ctrlKey elsewhere — the same mod semantics the registry uses, but usable from raw mouse/keyboard handlers. Modifier normalization happens at the click boundary so downstream logic is untouched. Also added an enter entry to the display maps so formatKeysForDisplay can render the submit hints.

No macOS behavior changes (on mac isPrimaryModifier === metaKey).

Testing

  • pnpm typecheck
  • pnpm lint:theme
  • pnpm build
  • pnpm --filter @slayzone/shortcuts test — added unit tests for isPrimaryModifier; no new failures.

🤖 Generated with Claude Code

Greptile Summary

This PR makes primary-modifier shortcuts work consistently across macOS, Windows, and Linux. It changes:

  • Adds isPrimaryModifier for raw keyboard and mouse handlers.
  • Updates create-task, terminal-link, and kanban click handlers to use Ctrl off macOS.
  • Replaces hardcoded Cmd hints with platform-aware shortcut labels.
  • Adjusts terminal copy/paste and hover hints for Windows/Linux bindings.
  • Adds shortcut tests for the new primary-modifier helper.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Reviews (2): Last reviewed commit: "fix: address review on Windows shortcut ..." | Re-trigger Greptile

Several raw mouse/keyboard handlers gated on event.metaKey, which is the
Super/Win key off macOS — so the Cmd-equivalent actions were dead on
Windows and Linux. Add isPrimaryModifier() (Cmd on mac, Ctrl elsewhere,
matching the shortcut registry's `mod` semantics) and route these
handlers through it:

- CreateTaskDialog: Ctrl+Enter / Ctrl+Shift+Enter now create the task
- Terminal: Ctrl+Click opens URLs/files (browser / editor / external)
- Kanban board & list: Ctrl+Click opens a task in the background

Also fix hardcoded U+2318 hint strings so they render "Ctrl" off macOS
via formatKeysForDisplay, add an enter to the display map, and show the
correct Ctrl+Shift+C/V copy-paste hints in the terminal context menu.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Comment thread packages/domains/terminal/src/client/Terminal.tsx
Comment thread packages/shared/shortcuts/src/platform.ts
- Terminal URL hover hint: build the shift token separately so non-mac
  renders "Ctrl+Shift+Click" instead of the run-together "CtrlShift+Click"
  (formatKeysForDisplay joins parts without separators).
- isPrimaryModifier: off macOS, require meta to be absent (`ctrlKey &&
  !metaKey`), matching the registry's rejection of non-mac events with
  meta held — so it no longer fires for Ctrl+Win+Click / Ctrl+Win+Enter.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant