Skip to content

Feature: Configurable Keybindings for RapidRaw#1083

Merged
CyberTimon merged 17 commits into
CyberTimon:mainfrom
sefalkner:controls-config
Apr 26, 2026
Merged

Feature: Configurable Keybindings for RapidRaw#1083
CyberTimon merged 17 commits into
CyberTimon:mainfrom
sefalkner:controls-config

Conversation

@sefalkner
Copy link
Copy Markdown
Contributor

@sefalkner sefalkner commented Apr 24, 2026

Configurable Keybindings for RapidRaw

This PR introduces configurable keybindings/controls for RapidRaw. As a requirement for that, the handleKeyDown was refactored going from many nested if/else statements to a simpler to edit matching strategy.

This should give users the control they want, and we developers don't break their workflows as easily.

Motivation:

  • Make it your software - People might have different ideas of a good workflow
  • Make migration from other software easier
  • Internationalization - Record physical key positions instead of symbols
  • Custom Periphery - Maybe for the future
  • Safety - E.g., allow users to unassign delete
  • The big trackpad rugpull - Issues like BUG: Mouse scroll not zooming #1082 already came up for the changed mouse settings, your new panel for customization fits very well into the controls page

This should maybe get priority over #1078, as the numpad can be bound to tasks now.

For Users:

UI-wise, not a lot has changed (with full intent). To the user, they can now simply click on a keyboard on the shortcuts (now controls) page and record a keybinding.

Users can also "unassign" a function as described above. If keybindings already exist, they are marked as conflicting but not auto-removed. If conflicting keys are kept, the first one in the handleKeyDown of the conflicting ones fires, should be pretty safe.

For Developers:

I tried my best to not bloat the code unnecessarily while allowing for easy extension later.

Key Recording records physical key position through event.code, more robust on different language keyboards than the actual key.

There are two types of keybindings, builtin and user configurable. Builtins are always checked first, meaning the user can't override them.

New keybinds just get added to KEYBIND_DEFINITIONS. Each one has a condition (shouldFire) and a handler (execute). On key press, builtin guards run first; if none match, the pressed combo is looked up in the user-configured map and its handler runs.

Needs Feedback/Discussion/Testing:

  • macOS
    Since I don't have access, I'd appreciate some testing there, especially the ctrl+delete shortcuts.
  • numlock
    Numlock is currently not respected, as we record the physical key positions.
  • Locale Handling
    Right now, keybinds are displayed on a QWERTY keyboard. This is a compromise many packages do, even vscode, but maybe we can do better in the future. Sadly this is not fully supported yet: https://developer.mozilla.org/en-US/docs/Web/API/Keyboard_API
  • Primary/secondary
    For now, there is just a single keybind per action, but giving a secondary should be easy, do you prefer that?
  • Smarter Conflict detection
    For keybind that only fire in certain situations, the conflict detection should not fire if they never could collide with another specific keybind.
  • Brush Size changes
    I was not able to get it running, the regression might actually be not in the keybind code
  • Where should the keybind definition live
    Right now it's in src/utils/keyboardUtils.ts, which is a bit underwhelming given its importance

Let me know your feedback and ideas, I'd be fine we keep this open until all points are discussed.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Performance improvement
  • Code refactoring
  • Documentation update
  • UI/UX improvement
  • Build/CI or Dependency update

Screenshots/Videos

Screenshot From 2026-04-24 19-20-28

Testing

  • I have tested these changes locally and confirmed that they work as expected without issues

Test Configuration:

  • OS: Ubuntu 24.04
  • Hardware: AMD AI HX 370

Checklist

  • My code follows the project's code style
  • I haven't added unnecessary AI-generated code comments
  • My changes generate no new warnings or errors

AI Disclaimer:

Please state the involvement of AI in this PR:

  • This PR is entirely AI-generated
  • This PR is AI-generated but guided by a human, in no world I'd reformat these keybinds like a caveman ;)
  • This PR was handwritten with AI assistance (spell check, logic suggestions, error resolving)
  • This PR contains only blood, sweat, and coffee (AI-free)

@sefalkner sefalkner requested a review from CyberTimon as a code owner April 24, 2026 17:56
@sefalkner sefalkner mentioned this pull request Apr 24, 2026
6 tasks
@CyberTimon
Copy link
Copy Markdown
Owner

This looks absolutely amazing!! Really clean refactor and a huge usability win. The configurable keybindings and the move away from nested conditionals make the system much easier to extend and reason about.

Looks good to me, will merge now! 💯

@CyberTimon CyberTimon merged commit 8191e23 into CyberTimon:main Apr 26, 2026
12 checks passed
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