Skip to content

Incorrect characters for number keys on Czech layout #53

Description

@p0deje

Thank you for creating this library, it's been essential for my clipboard manager - https://github.com/p0deje/Maccy. I can't even imagine handling all the complexity of converting keycodes to characters and back myself. 🙏🏻

I have been investigating one of the bugs reported by users p0deje/Maccy#482 (comment) and it seems like it could be a problem in the Sauce library itself.

On specific keyboard layouts, for example, Czech, the numbers row is mapped to accented characters and numbers are available by pressing ⇧.
Screenshot 2023-01-31 at 09 26 23

I am trying to find a proper character to pass to NSMenuItem.keyEquivalent and I would normally do something like this:

let keyCode = Sauce.shared.keyCode(for: .one)
let char = Sauce.shared.character(for: Int(keyCode), cocoaModifiers: [])
// ▿ Optional<String>
//  - some : "1"

However, I would expect "+" to be returned in this case. I traced the problem to CoreServices.UCKeyTranslate but I'm not sure how to properly use it to find a necessary character.

I would happily submit PR to fix the problem but need some guidance.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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