Skip to content

Let an empty key list in keymap.json unbind a command - #2950

Merged
manilabui merged 2 commits into
Foundry376:masterfrom
brhellman:keymap-empty-unbinds
Oct 15, 2026
Merged

manilabui merged 2 commits into
Foundry376:masterfrom
brhellman:keymap-empty-unbinds

Conversation

@brhellman

@brhellman brhellman commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

There is no way to remove a keyboard shortcut. The Shortcuts preferences page can only replace one, and writing "core:archive-item": [] into keymap.json doesn't work either: KeymapFile.load created a command's entry only while pushing its first keystroke, so an empty list left no entry, and the template's e stayed bound.

The entry is now created before the loop, so [] is a command with no keys. The user keymap replaces lower layers per command (keymapCacheInvalidated), so that unbinds it. A template could also list [] to drop a base binding, the same way it already replaces one.

This is the groundwork for removing shortcuts from the Shortcuts page (an × per key, Clear per section, Clear all), which needs a file format that can say "none". That comes as a follow-up.

Verified: keymap-manager-spec loads base + Gmail + a user keymap.json from a temporary config folder. {"core:archive-item": []} leaves the command with no keys and e registered to nothing (red with the old loop). A listed command's keys replace the template's. Live, in this branch's build on a copy of a live Gmail-template config (Electron 44.5.1, DevTools Input.dispatchKeyEvent, queueTask stubbed): with an empty user keymap, e on a focused thread queued its archive. With {"core:archive-item": []}, the bindings were [] and e queued nothing. On master the same file left ["e"]. Lint, prettier and tsc clean; full suite 2441 passing on this branch (master 4ebb582fb).

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

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>
@manilabui
manilabui merged commit f2d305b into Foundry376:master Oct 15, 2026
1 check passed
@brhellman
brhellman deleted the keymap-empty-unbinds branch October 16, 2026 11:35
kvnloo pushed a commit to kvnloo/Mailspring that referenced this pull request Oct 22, 2026
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: Brian Hellman <brian.hellman@linbit.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit f2d305b)
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.

2 participants