Skip to content

Allow accelerators based on keyboard-types Key #333

@LeonMatthes

Description

@LeonMatthes

Hi,
First of all, thank you all for developing and maintaining muda. We are happily using it in Slint for our native menu bars and context menus. 😊

Recently we ran into the limitation that muda only allows creating accelerators based on keyboard-types Code type, which doesn't allow expressing all keyboard shortcuts that Slint supports.
Concretely, the Code type is limited to physical key codes, even though accelerators usually use "logical" keys - e.g. the string that was produced by the keypress, not the physical key position.

That means that Muda currently does not support keyboard shortcuts like Control + +/Control + {/Control + €, etc.

I would like to contribute to muda to add support for these kinds of keyboard shortcuts.

In my opinion the right approach is to add support for the Key type from keyboard-types instead of the Code type.
Key is the right type because it represents a logical keypress that produced a certain string instead of a physical key position.

Ideally, I think accelerators should entirely migrate to using the Key type, but I can understand that for backwards compatibility it is probably better to continue offering the constructor that accepts a Code.

Would you consider merging a pull request that adds an additional constructor for accelerators that use the Key type?
Also, would you prefer keeping the existing Code constructor, or remove it entirely?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions