Skip to content

Add a way to resolve KeyCode according to the Keyboard Layout #456

@CryZe

Description

@CryZe

KeyCode is based on a Keyboard layout independent web specification. This is great as this means the hotkeys will always refer to a very specific key on the Keyboard no matter the operating system or currently active layout. However when visualizing these in some user interface, the user would prefer to see the key as it is on their keyboard.

I have a WIP implementation for all the platforms, but there are some issues:

  • For Linux we need an open X11 connection.
  • In the web the API is actually async, and I don't want to expose it that way in Rust.

I initially started implementing this as a free method on KeyCode but it will likely for the reasons above need to be a method on Hook / HotkeySystem. The reason for this is that for the web we need a point where we start up the Promise that loads the layout map, such that later when we call the resolve method, the result would be available (hopefully, if not we'll just use the fallback implementation, but it resolves basically immediately on the next tick). The Hook / HotkeySystem constructor is the ideal point in time for this. Also since we need an open X11 connection on Linux, we can just reuse the one we already use for the hotkey handling. Thus implementing this as a method seems to work reasonably well on all platforms.

  • Windows
  • macOS
  • Linux
  • Web

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementAn improvement for livesplit-core.featureA new user visible feature for livesplit-core.hotkeyThis is about the hotkey implementation.priority: highThis is a high priority issue.work in progressSomeone is working on this.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions