Skip to content

Warn when a shortcut you added also runs another command - #2955

Open
brhellman wants to merge 54 commits into
Foundry376:masterfrom
brhellman:shortcut-conflicts
Open

brhellman wants to merge 54 commits into
Foundry376:masterfrom
brhellman:shortcut-conflicts

Conversation

@brhellman

@brhellman brhellman commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

With #2952 you can add a key that another command already uses, and nothing warns you. KeymapManager runs every command bound to a key (ensureKeystrokesRegistered dispatches each in _commandsCache[keys]), so adding Gmail's s to Archive makes s archive and star. Measured in the #2953 build: recording s on Archive saved ["e", "s"] with no notice.

  • What counts as a conflict: a key you added that another command also has. The defaults share keys on purpose, because each command only acts in its own place: Outlook's Ctrl+U underlines in the composer and marks unread in the list (the existing keymap-manager-spec dispatches both), Ctrl+Shift+L is bulleted list or go to Inbox, and Ctrl+A selects text or threads in every template. Flagging those would warn every user about choices they never made. To tell the two apart, KeymapManager keeps each command's keys from before the user keymap (getDefaultBindingsForCommand), and addedBindings is a command's keys minus those. mod and ctrl count as one key on Windows and Linux.
  • What you see: both keys get an amber outline, with "Also runs Star" on hover. The row the key was added to says "S also runs Star." and offers Remove from Star or Remove here. The top of the page counts them: "1 shortcut you added also runs another command."
  • findConflicts checks every command's keys, including commands not listed on the page, such as core:undo. Commands without a label show their id.

Stacked on #2953 (and through it #2952 and #2950).

Verified: shortcut-conflicts-spec covers the helpers (added keys, mod/ctrl spelling per platform, both sides reported, defaults' overlaps never flagged even on a changed command, each other command named once), a mounted row (both chips marked with the hover text, the message only where the key was added, Remove from / Remove here), and the mounted page (singular and plural counts, counting each added clash once, Remove from Star keeping Star's other keys, silence for Outlook-style overlaps). keymap-manager-spec covers getDefaultBindingsForCommand. Every statement and condition added was mutated: 25 of 25 red. Live, in this branch's build on a copy of a Gmail-template config (Electron 44.5.1, DevTools input): + on Archive then s showed the count, flagged S on Archive and Star, and the message. Remove from Star left Star with None and {"core:archive-item": ["e","s"], "core:star-item": []}, and the warnings cleared. Lint, prettier and tsc clean; full suite 2482 passing.

Screenshots (copy of a Gmail-template config, s added to Archive while Star has s):

master: no warning this branch
master conflict

After Remove from Star:

resolved

Shortcuts page series (one concern each; merge in this order): #2950 [] unbinds, #2951 mail held behind Preferences, #2952 record with +, #2953 remove keys, #2955 conflict warnings, #2956 visual pass, #2957 search, #2958 single-key switch, #2959 Show filter.

🤖 Generated with Claude Code

Brian Hellman and others added 5 commits October 7, 2026 20:59
KeymapFile created a command's entry only while pushing its first keystroke, so `[]` left no
entry and the template's keys stayed bound: there was no way to remove a shortcut, even by
editing the file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Recording began whenever a row took focus and ended on its own, a single plain key could not be
recorded (the row waited for a second one and saved "k then j"), and the result replaced every
key the command had. Recording now starts from a + button and says so; a modifier combination
ends it at once, a plain key after Mousetrap's one-second sequence timeout; Esc cancels; the
key joins the command's existing ones; focus returns to the button.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… or all

Each key is a chip with an x that removes it (and any other spelling of the same key), a
command the user keymap changed gets a Reset back to the template, each section has a Clear,
and Clear All (confirmed) empties every command. A command left with no keys is written as
`[]`, which unbinds it. "None" is localized now that it shows on cleared commands.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every command bound to a key runs when it is pressed, so adding "s" to Archive while Star has
"s" made one key archive and star. The Shortcuts page now marks both keys, says on the row the
key was added to which other command it runs, offers to remove it from either, and counts these
at the top. The defaults' own shared keys (Outlook's Ctrl+U underlines in the composer and marks
unread in the list) are not flagged: KeymapManager keeps each command's keys from before the
user keymap so a key the user added can be told from one the template gave.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brian Hellman added 17 commits October 10, 2026 06:34
Brian Hellman added 30 commits October 23, 2026 22:44
…licitly

# Conflicts:
#	app/lang/en.json
#	app/lang/hu.json
#	app/lang/pt.json
# Conflicts:
#	app/lang/en.json
#	app/lang/hu.json
#	app/lang/pt.json

This branch has not been deployed

No deployments
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