fix: respect Ctrl as the primary modifier on Windows/Linux#92
Open
mthorme wants to merge 2 commits into
Open
Conversation
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>
- 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On Windows (and Linux), several interactions were dead because the handlers gated on
event.metaKeydirectly. Off macOS,metaKeyis 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 (
matchesShortcutmapsmod→ Ctrl off macOS). The bugs were all in raw handlers that bypass it.What this fixes
Ctrl+Enter/Ctrl+Shift+Enternow create the task (wasmetaKey-only).Ctrl+Clickopens URLs and file paths (browser / editor / external), matchingCmd+Clickon macOS.Ctrl+Clickopens a task in the background.⌘strings now renderCtrloff macOS viaformatKeysForDisplay(Create button, terminal hover hints). The terminal context menu now shows the realCtrl+Shift+C/Ctrl+Shift+Vcopy-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 returnsmetaKeyon macOS andctrlKeyelsewhere — the samemodsemantics the registry uses, but usable from raw mouse/keyboard handlers. Modifier normalization happens at the click boundary so downstream logic is untouched. Also added anenter→↩entry to the display maps soformatKeysForDisplaycan 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 forisPrimaryModifier; no new failures.🤖 Generated with Claude Code
Greptile Summary
This PR makes primary-modifier shortcuts work consistently across macOS, Windows, and Linux. It changes:
isPrimaryModifierfor raw keyboard and mouse handlers.Confidence Score: 5/5
This looks safe to merge.
Reviews (2): Last reviewed commit: "fix: address review on Windows shortcut ..." | Re-trigger Greptile