Skip to content

Rebind every canvas key; choose the double-tap key (⌘ by default on macOS) - #8

Merged
Feargin merged 3 commits into
mainfrom
canvas-keys
Oct 14, 2026
Merged

Feargin merged 3 commits into
mainfrom
canvas-keys

Conversation

@Feargin

@Feargin Feargin commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator

What

Settings → Canvas keys: every canvas action is listed by group (general, tools, colors, widths). Click the key, press the new combination, and it is saved.

  • Esc cancels recording.
  • A combination already used by another action moves to the new one, and a note says where it was taken from.
  • ↺ restores one key, Reset all keys restores everything.
  • The cheat sheet (F1) and the toolbar tooltips always show the current keys.
  • Keys follow the physical key (e.code), so they work on any layout. Mod is Ctrl on Windows/Linux and ⌘ on macOS, and labels use ⌘ ⌥ ⇧ ⌃ on macOS.
  • Holding and double-tapping Alt stay fixed: they are polled in Rust (keys.rs).

How

  • src/core/keymap.js — pure logic: combo from a key event, resolve defaults + overrides, assign with stealing, lookup, digit runs for the cheat sheet. Tests in tests/keymap.test.js.
  • src/ui/shortcuts.js — the registry of actions and default keys; keyboard.js dispatches through it instead of hard-coded ifs.
  • src/ui/keys-settings.js — the settings section.
  • settings.json keeps only the overrides (keys). Rust validates the shape on load and in the new set_keys command.
  • The 9 toolbar labels no longer have the key baked into the translation (Undo (Ctrl+Z) → Undo); the key is appended from the current bindings. 6 new strings in all 11 languages.

Checked

  • npm run check, npm test (16, 4 new), cargo fmt --check, cargo clippy --all-targets -D warnings, cargo test (11, 1 new) — clean.
  • The UI in a browser with a mocked Tauri API:
    • recording, stealing (with the note), Esc cancel;
    • per-key reset and reset all; persistence across reload;
    • new keys fire on the canvas and old ones stop;
    • macOS labels, and Option+digit picking a color.
  • npm start launches the app.

CHANGELOG.md gets a [0.4.0] section. #7 (Linux on 22.04, statistics fix) adds [0.3.1]; I'll merge both notes into [0.4.0] when releasing them together.

🤖 Generated with Claude Code

Feargin and others added 2 commits October 14, 2026 16:46
Settings → Canvas keys lists every action — general, tools, colors,
widths. Click a key and press the new combination to record it (Esc
cancels); a combination already in use moves to the new action, ↺
restores one key, "Reset all keys" restores them all.

- core/keymap.js: combos by physical key (e.code), Mod = Ctrl or ⌘,
  assignment, overrides vs defaults; tested with node:test
- ui/shortcuts.js: the registry of actions and default keys;
  keyboard.js dispatches through it instead of hard-coded checks
- the cheat sheet and toolbar tooltips show the current keys; the key
  hints are no longer baked into the translated labels
- settings.json keeps only the overrides (`keys`); Rust validates their
  shape on load and in set_keys
- holding and double-tapping Alt stay fixed (polled in keys.rs)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On macOS a double tap of ⌥ is taken by other apps (Claude's quick entry
opens on it), and double ⇧ / ⌃ are JetBrains shortcuts, so toggling
click-through with a double ⌥ also fired those. The double-tap key is
now a setting — Alt, Ctrl, Shift, ⌘ (macOS only) or off — with ⌘ the
default on macOS and Alt on Windows. Holding Alt / ⌥ is unchanged.

- keys::Tap and poll(tap): the tap key is polled separately from the
  hold key; "other keys" exclude the tap key's own codes
- tap_key in settings.json (invalid → platform default; missing →
  platform default, so existing Mac installs move to ⌘)
- set_tap_key validates and updates the overlay state
- Settings: a select next to the hotkey (hidden on Linux); the cheat
  sheet shows the chosen key

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Feargin Feargin changed the title Rebind every canvas key in Settings Rebind every canvas key; choose the double-tap key (⌘ by default on macOS) Oct 14, 2026
@Feargin

Feargin commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator Author

Added: the double-tap key is now a setting (Settings → Double-tap for click-through): Alt, Ctrl, Shift, ⌘ (macOS only) or off.

  • Default on macOS is ⌘. A double ⌥ is taken by other apps (it opens Claude's quick entry), and double ⇧ / ⌃ are JetBrains shortcuts.
  • Windows keeps Alt.
  • Existing installs: Mac users without the setting get ⌘ automatically.
  • Holding Alt / ⌥ is unchanged.

Checked: Rust tests (13), the select in a browser harness for both Windows (no ⌘ option, Alt default) and macOS (⌘ default), the cheat sheet follows the choice, npm start. The macOS polling branch compiles only on the macOS CI runner.

🤖 Generated with Claude Code

@Feargin
Feargin merged commit 52370fa into main Oct 14, 2026
8 checks passed
@Feargin
Feargin deleted the canvas-keys branch October 14, 2026 14:05
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