Skip to content

feat(keys): make keyboard shortcuts remappable per map - #1885

Merged
l0gicgate merged 28 commits into
lgse:mainfrom
wmfeht:feat/remappable-keyboard-shortcuts
Oct 28, 2026
Merged

l0gicgate merged 28 commits into
lgse:mainfrom
wmfeht:feat/remappable-keyboard-shortcuts

Conversation

@wmfeht

@wmfeht wmfeht commented Oct 25, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Adds remappable keyboard shortcuts, with separate tables for the default map and the 10xer map. Each commit is one stage:

  1. Command registry (3 refactor commits). Every shortcut is a Command with defaults for each map. Handlers, labels and the F1 reference resolve through it, and the per-map duplicate constants are merged. Shipped behavior is unchanged.
  2. Structural aliases. Escape, Enter, Tab and the arrows resolve through alias commands, so they can take extra keys. Physical Escape always cancels.
  3. Saved overrides. Overrides are stored in settings.toml under [keymap.default] and [keymap.tenxer], holding only the changes from the shipped keys. An empty list unbinds a command. Unknown ids and unreadable entries are kept as written. Matching, labels, hints, tooltips, accessible labels, context-menu accelerators, the footer and F1 all update live.
  4. Conflict checker (src/ui/keys/conflicts.rs). It reports duplicates, shadowed chord groups, keys that never fire, keys reserved by GTK, fixed keys and input-method keys, plus context overlaps. Hand-edited entries are audited once at load and logged. Guard tests press keys through the real dispatchers, so the checker can't silently drift from them.
  5. Settings → Keyboard page (heading KEYBINDS). Default/10xer switch, a Search keybinds field that filters rows by action name, a chip per key with remove, Add, per-row reset and Reset all. Keys are captured inline. Errors refuse the key; warnings save it and show a short note under the row. Each table lists only the actions its mode can run. Settings search finds a row by action name or key. All new strings are in the twelve catalogs.
  6. Direct commands. A new dispatch stage, unbound by default, runs commands that only one map had a key for: 10xer verbs, sort and copy-as steps and navigation in the default map, and duplicate, pin, jump to folder and arrow scope in 10xer. Each acts on the active map's own targets.
  7. Custom action slots. The default table gains Custom action 1–10, unbound by default. Slot N is the Nth action in Settings → Actions' order, and its row shows that action's current name underneath (or No action). A key on a slot runs that action on the selection through the same path as 10xer's ; digits; an empty, disabled or non-matching slot runs nothing and says so. 10xer keeps its ; digits and doesn't list the slots.
  8. QA scenarios and docs. Six scenarios in tests/qa/scenarios/keymap/ (the QA runner's prefs now writes nested tables), a new user guide docs/keymap.md, and updated docs/keyboard-shortcuts.md, docs/preferences.md, docs/10xer-mode.md and docs/custom-actions.md.

main is merged in. Its new Reopen the last closed tab key (Ctrl+Shift+T) is registered as a remappable command, and its new accessible labels on shortcut buttons follow rebinds.

Also fixed along the way:

  • A rebound document zoom reset now follows its own keys.
  • History, parent folder and home work when bound to a Ctrl or Super key.
  • AltGr no longer cancels an armed 10xer chord.

Deviations from the plan

  • The branch name has no issue number, because the issue was opened after the work started.
  • The plan's StepEqualsTrigger rule was dropped: shipped g g, c c and t t are valid steps on their own trigger key.
  • The Russian-layout scenario captures the key that types у (Ctrl+E) rather than с, because Copy holds Ctrl+C.
  • In the default map, direct Move to, Copy to, Extract to, search and folder jumps open the 10xer footer prompts.
  • The plan's E2E coverage became QA scenarios, because main replaced the E2E suite.

Known limitations, not fixed here

  • Keys added to the default table for a few file-list commands also fire in 10xer: hidden files, page down, last item, preview and Back. This happens because unclaimed 10xer presses fall through to default stages. It is documented, but the 10xer table in Settings doesn't show these keys.
  • Adding or removing a custom action can shift the actions after it to other slots; renaming or disabling one doesn't.
  • On AZERTY, Ctrl+& records <Control>ampersand when Ctrl+1 is free.
  • A few messages still have no keyless form for unbound commands: the F1 panel note and "Pinned … as …".

Bugs that predate this branch (they reproduce on main with the shipped keys; not fixed here):

  • Columns, default map: Delete trashes a focused row the user deselected.
  • Columns with a pane filter: names are listed in reverse order, and picking a sort drops a multi-selection.
  • Columns, default map: p after clicking a folder pins nothing.
  • Default map: y copies nothing while filter results are showing.

Visual evidence

N/A. Agents can't upload attachments. The change adds a Settings → Keyboard page titled KEYBINDS, with a search field, a Default/10xer switch, and a row per command showing key chips, Add, Reset and short notes; custom action slot rows show the action's name underneath.

How to test

  1. Open Settings → Keyboard and type rename in Search keybinds.
  2. Click Add on Rename, press Ctrl+E, then remove the F2 chip.
  3. Close Settings and press Ctrl+E on a file in the list. Then press F2.
  4. Back on the page, click Add on Rename again and press Ctrl+C.
  5. Switch to the 10xer table, rebind a key there, and toggle 10xer mode (Ctrl+Shift+M).
  6. Create a custom action in Settings → Actions, then on the Keyboard page's Default table bind a key to Custom action 1 and press it on a matching file.
  7. Quit Strata. In settings.toml, add [keymap.default] with toggle_hidden_files = ["F7"], then relaunch and press F7.

Expected result:

  • Step 1: only the Rename row is listed.
  • Step 3: Ctrl+E starts an inline rename and F2 does nothing.
  • Step 4: the key is refused with a note that Copy holds Ctrl+C, and the table is unchanged.
  • Step 5: the default map is unaffected.
  • Step 6: the Custom action 1 row shows the action's name, and the key runs it on the file.
  • Step 7: F7 toggles hidden files without opening Settings, and F1 lists F7 for that command.

Related issue

Closes #1884

…m them

Store per-command overrides in settings.toml under [keymap.default] and [keymap.tenxer], keeping unknown ids and unreadable entries verbatim. Shortcut matching, labels, hints, tooltips and the F1 reference resolve from the active map's overrides and update live.
Add a pure conflict checker that reports duplicates, shadowed chord groups, keys that never fire, fixed and GTK-reserved keys, input-method keys and context overlaps for a proposed binding or a whole table. Hand-edited settings.toml entries are audited once at load and logged. Guard tests drive the real dispatchers to keep the checker in step with them. Check document zoom reset before text size so each follows its own keys.
Add a Settings page that lists every command in the Default and 10xer tables, with chips per key, Add, per-row reset and Reset all. Keys are captured inline, refused when the conflict checker reports an error and saved with their warnings shown. Labels leave out keys that never fire, unbound commands get keyless tooltips, and Settings search finds rows by action name or key.
Add a direct-commands stage, unbound by default, so a user can bind commands that only one map had a key for: 10xer verbs, sort and copy-as chord steps and navigation in the default map, and duplicate, pin, jump to folder and arrow scope in 10xer. Each runs through its existing handler on the active map's own targets. The checker reports commands that still have no path in a map. Ctrl- and Super-bound history and home keys now work, and keys added to 10xer commands work from a read-only text preview.
Add end-to-end scenarios for rebinding through Settings, overrides saved before launch, independent tables, structural aliases, capture on Russian layouts and refused conflicts. Add a keymap user guide and turn the shortcut guide's checklist into adding a command. The E2E harness can seed keymap tables, and the default-map footer shows the query of a search started from a direct key.
Rename the page heading to Keybinds and add a field that narrows the shown table by action name. Each table now lists only the commands its map can run, so the default table drops its 10xer mode section and the 10xer-only verbs and chord steps, and the 10xer table drops the default-only type-to-search filter key.
…board-shortcuts

# Conflicts:
#	data/locales/de.json
#	data/locales/en.json
#	data/locales/es.json
#	data/locales/fr.json
#	data/locales/it.json
#	data/locales/ja.json
#	data/locales/ko.json
#	data/locales/pt-BR.json
#	data/locales/ru.json
#	data/locales/vi.json
#	data/locales/zh-CN.json
#	data/locales/zh-TW.json
#	docs/e2e-testing.md
#	docs/keyboard-shortcuts.md
#	docs/preferences.md
#	src/ui/browser/pane_header.rs
#	src/ui/browser_modes.rs
#	src/ui/chooser/tests/keyboard.rs
#	src/ui/keys/bindings/window.rs
#	src/ui/preferences.rs
#	src/ui/preferences/tests/preferences.rs
#	src/ui/preview.rs
#	src/ui/settings.rs
#	src/ui/shortcut_reference.rs
#	src/ui/window.rs
#	src/ui/window/composition/layout.rs
#	src/ui/window/composition/tabs.rs
#	src/ui/window/keyboard/preview.rs
#	tests/e2e/unit/test_harness.py
Port the deleted tests/e2e/scenarios/test_keymap.py to six scenarios in tests/qa/scenarios/keymap/. Header prefs now write object values as TOML tables, so a scenario can seed [keymap.default]. The Keyboard page's Add, Reset, Cancel and capture buttons now drop their text label relation through accessibility::clear_labelled_by, so QA targets resolve their accessible names.
@wmfeht
wmfeht marked this pull request as ready for review October 25, 2026 20:41
@l0gicgate

Copy link
Copy Markdown
Contributor

Review pass: merged main (ac5ab4f) with a merge commit and pushed three fix-ups on top. Nothing in the PR's design changed.

Fixed

  • Settings search: a query that matched only the Keyboard page's aliases (for example hotkeys or rebind) opened the page with every row hidden, because rows were only shown when they scored themselves. A page match now lists every row (src/ui/settings/search.rs), with a case added to search_finds_rows_by_action_and_key.
  • File chooser: history, parent and home bound to a Ctrl key worked in the window but not in the chooser, which returned on Ctrl before reading them. The Ctrl guard now lets an exact match of those four commands through; saved_overrides_reach_the_chooser_dispatcher covers parent_folder = ["<Control>e"].
  • Previews: a rebound first_item was ignored by document and archive previews while last_item was honoured; both are read now. Hidden-files pass-through from a focused preview keyed on a held Ctrl, so a 10xer rebind such as Alt+H was swallowed; it now passes any key that types nothing.
  • Conflict checker: a saved entry for a command the map has no path to (for example yank under [keymap.default]) still counted as a duplicate, so Settings refused that key for every other command and named a command with no row. Such entries, and entries that never match, are skipped (compare_with_table), with a row in conflicts/tests.rs.
  • Num Lock and Scroll Lock are refused as shortcut keys; a [keymap.default] or [keymap.tenxer] value that is not a table is now logged when dropped, like every other rejected entry.
  • direct_commands::tenxer_runs_default_map_commands_bound_to_a_key failed about two runs in five locally: after the duplicate row, the harness deleted the copy and refreshed while the transfer's own listing refresh was still publishing, leaving the column empty. The harness now waits for the listing to match the folder before mutating it; six consecutive runs pass.

Removed

  • merged_commands_keep_each_maps_key_set (restated the catalog literally), inactive_findings_mark_keys_that_never_fire_there (restated the inactive() match), the spoofed RENAME_SHIPPING_SEMICOLON row, and a NeverMatches row that could not fail. Group::id is test-only now, and a handful of doc comments that restated their signatures were dropped.

Verified locally: cargo fmt --check, cargo clippy --all-targets --all-features -D warnings, the full headless Rust suite (3640 passed, 0 failed, 11 ignored) and the six keymap/ QA scenarios in the pinned container (7 runs, all pass). Visual evidence: N/A.

@l0gicgate

Copy link
Copy Markdown
Contributor

Follow-up pushed in 5f26eb3: the Keyboard page stacked every keybind row (title above, chips and Add below) once the dialog's logical width fell under the 1250px compact breakpoint, which happens at the default dialog width with a larger text size. Keymap rows now stay on one line down to the 600px narrow breakpoint the text-size row already uses, since the chip row wraps on its own. Verified with container screenshots at text size 15 (1440px and 1000px windows) and at a 640px window; fmt, clippy and the ui::settings:: tests pass.

@l0gicgate

Copy link
Copy Markdown
Contributor

Follow-up pushed in 3e08b6d: rows whose chips wrapped (10xer Page up/down, thumbnail commands with extra keys) were cut off because GtkBox measures the copy column's width for the row height only while allocating, and the wrapping note label answers that wider than its plain minimum, so the row height was computed with the chips on one line and allocated with them on three. The copy column now sits in a wrapper that answers both measures alike; the chips keep their natural width on one line and the note wraps beside them. Verified with container screenshots of the 10xer table at 1440px and 1000px windows with text size 15 and at a 640px window; fmt, clippy and the ui::settings:: tests pass.

@l0gicgate

Copy link
Copy Markdown
Contributor

Follow-up pushed: the previous row fix still clipped rows in the full, scrolling table. GtkBox computes a row's minimum height by searching for the split between the copy and the chips that wraps least, but allocates the natural split, and a scrolled viewport gives the content its minimum height, so any row whose copy and chips both wrap came out short. The keymap row is now the page's own wrap row, which measures the split it allocates; the copy keeps at least 20 characters and the chips drop below it when both cannot fit, which replaces the compact-mode stacking special case from the earlier commit. Verified on host GTK 4.24.1 and in the pinned container (GTK 4.22) at 1440px, 1000px and 640px windows, filtered and unfiltered, with text size 15; fmt, clippy and the ui::settings:: tests pass.

@l0gicgate

Copy link
Copy Markdown
Contributor

Follow-up pushed: Reset all on the Keyboard page now asks first. It opens the same message dialog as deleting a custom action, titled "Reset all keybinds?" with the shown mode as its subtitle and the existing description text, with Cancel and a danger-toned Reset. The title is added to all twelve locale catalogs; the description and button labels reuse strings that were already translated. The keyboard test covers cancelling (overrides kept) and confirming (map reset), the fixture now hosts the page under an overlay as Settings does, and the two docs that describe Reset all mention the confirmation. Verified with a container screenshot; fmt, clippy, the i18n:: and ui::settings::keyboard:: tests pass.

@l0gicgate

Copy link
Copy Markdown
Contributor

Follow-up pushed: the Keyboard page header is reordered. The KEYBINDS heading is gone (the page is already titled Keyboard, and the string is removed from all twelve catalogs), the Default / 10xer mode switch now comes first with Reset all at the right end of the same row, and the keybind search sits beneath it as the filter on that scope, with the first section heading at the page's usual gap. On a narrow dialog Reset all wraps to its own line, right-aligned. Verified with container screenshots at 1440px and 640px; fmt, clippy, the ui::settings:: and i18n:: tests pass.

@l0gicgate

Copy link
Copy Markdown
Contributor

Follow-up pushed: the Settings navigation rows padded 18px on the left and 10px on the right; they now pad 11px on both sides, which also puts each row's icon centre on the search field's icon centre (measured at x=60 for both in the container's widget tree). CSS only.

@l0gicgate
l0gicgate merged commit 73b3258 into lgse:main Oct 28, 2026
11 checks passed
wmfeht added a commit that referenced this pull request Oct 31, 2026
…tions-chord

Resolve the conflicts with remappable shortcuts (#1885) by making the
folder actions step a command, "actions.folder" step(Actions) on ".", so
it can be rebound, the conflict checker sees it, and Settings lists it
as "Actions for the focused folder" in the 10xer table. The digits after
it and the "; .-" pill are built from Shown values and follow the user's
keys for both ";" and ".". Lettered steps are read before it, and digits
after, as an armed chord reads its steps first.

Restore the Digits and Chord::options doc comments, and document the new
step in the keymap, preferences and keyboard-shortcuts guides. It has no
path in the default map, where there is no panel to switch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remappable keyboard shortcuts per map

2 participants