[GH-ISSUE #56] Mismapping Azerty/Qwerty #43

Closed
opened 2026-05-05 04:47:46 -06:00 by gitea-mirror · 14 comments
Owner

Originally created by @ZorGleH on GitHub (Mar 8, 2016).
Original GitHub issue: https://github.com/keycastr/keycastr/issues/56

Hi,

I'm using an Azerty keyboard on latest OSX and latest keycastr to date. When I type "W" (major double w), it displays "Z". And vice-versa. Not the case for minor "z" or "w".

End of report 👍

Originally created by @ZorGleH on GitHub (Mar 8, 2016). Original GitHub issue: https://github.com/keycastr/keycastr/issues/56 Hi, I'm using an Azerty keyboard on latest OSX and latest keycastr to date. When I type "W" (major double w), it displays "Z". And vice-versa. Not the case for minor "z" or "w". End of report :+1:
gitea-mirror 2026-05-05 04:47:46 -06:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@scottopell commented on GitHub (Apr 22, 2016):

Same thing happens for Dvorak Keyboards.

For example, uppercase w and h display as < and J respectively.
This seems to happen with all "shifted" characters (uppercase).

It looks like some of the responsible code could be in the "transformer" class, since the uppercase letters (and symbols) are listed explicitly, but the lowercase ones aren't.

https://github.com/keycastr/keycastr/blob/master/keycastr/KCKeystrokeTransformer.m#L84

What is the purpose of this code?

UPDATE: It looks like this was added in PR #42 in order to fix symbols and uppercase letters not showing.

I don't have any experience with OSX api calls, but I would think that maybe there's a better api that could be used in which we get the literal character/codepoint vs the "key" that was pressed.

Or lacking that, perhaps there is an api that could "translate" between the key pressed and a character using the current user's keyboard settings.

<!-- gh-comment-id:213226718 --> @scottopell commented on GitHub (Apr 22, 2016): Same thing happens for Dvorak Keyboards. For example, uppercase `w` and `h` display as `<` and `J` respectively. This seems to happen with all "shifted" characters (uppercase). It looks like some of the responsible code could be in the "transformer" class, since the uppercase letters (and symbols) are listed explicitly, but the lowercase ones aren't. https://github.com/keycastr/keycastr/blob/master/keycastr/KCKeystrokeTransformer.m#L84 What is the purpose of this code? UPDATE: It looks like this was added in PR #42 in order to fix symbols and uppercase letters not showing. I don't have any experience with OSX api calls, but I would think that maybe there's a better api that could be used in which we get the literal character/codepoint vs the "key" that was pressed. Or lacking that, perhaps there is an api that could "translate" between the key pressed and a character using the current user's keyboard settings.
Author
Owner

@scottopell commented on GitHub (Apr 22, 2016):

I don't have XCode installed so I can't test this right now, but I have a theory that the problem is somewhere in these few lines of code

    TISInputSourceRef inputSource = TISCopyCurrentKeyboardLayoutInputSource();

    CFDataRef layoutData = TISGetInputSourceProperty(inputSource, kTISPropertyUnicodeKeyLayoutData);
    const UCKeyboardLayout *keyboardLayout = (const UCKeyboardLayout *)CFDataGetBytePtr(layoutData);

https://github.com/keycastr/keycastr/blob/master/keycastr/KCKeyboardTap.m#L216

I'll try to get XCode setup in the next few days and try out some different combinations.

Other projects seem to be using TISCopyCurrentKeyboardInputSource instead of TISCopyCurrentKeyboardLayoutInputSource

76c940ef69/src/keyboard_mac.mm (L61)

Relevant API Docs:
UCKeyTranslate
TISINputSourceRef

<!-- gh-comment-id:213420305 --> @scottopell commented on GitHub (Apr 22, 2016): I don't have XCode installed so I can't test this right now, but I have a theory that the problem is somewhere in these few lines of code ``` objc TISInputSourceRef inputSource = TISCopyCurrentKeyboardLayoutInputSource(); CFDataRef layoutData = TISGetInputSourceProperty(inputSource, kTISPropertyUnicodeKeyLayoutData); const UCKeyboardLayout *keyboardLayout = (const UCKeyboardLayout *)CFDataGetBytePtr(layoutData); ``` https://github.com/keycastr/keycastr/blob/master/keycastr/KCKeyboardTap.m#L216 I'll try to get XCode setup in the next few days and try out some different combinations. Other projects seem to be using TISCopyCurrentKeyboardInputSource instead of TISCopyCurrentKeyboard**Layout**InputSource https://github.com/alexandrudima/vscode-keyboard/blob/76c940ef6996254f10e3ee5cc642d98dfa004b7f/src/keyboard_mac.mm#L61 Relevant API Docs: [`UCKeyTranslate`](https://developer.apple.com/library/mac/documentation/Carbon/Reference/Unicode_Utilities_Ref/#//apple_ref/c/func/UCKeyTranslate) [`TISINputSourceRef`](https://developer.apple.com/library/mac/documentation/TextFonts/Reference/TextInputSourcesReference/#//apple_ref/c/func/TISCopyCurrentKeyboardInputSource)
Author
Owner

@kirbyk commented on GitHub (Apr 22, 2016):

Hey @scottopell I haven't taken the time to really look into this bug.

I went ahead and tested your potential solution and changing TISCopyCurrentKeyboardLayoutInputSource to TISCopyCurrentKeyboardInputSource results in the same issues on Dvorak.

Hopefully I can investigate later today and track down the issue. 👀

<!-- gh-comment-id:213438916 --> @kirbyk commented on GitHub (Apr 22, 2016): Hey @scottopell I haven't taken the time to really look into this bug. I went ahead and tested your potential solution and changing `TISCopyCurrentKeyboardLayoutInputSource` to `TISCopyCurrentKeyboardInputSource` results in the same issues on Dvorak. Hopefully I can investigate later today and track down the issue. 👀
Author
Owner

@Crocmagnon commented on GitHub (Jul 5, 2016):

This issue still affects me as well. Any update on a fix ? 😃

<!-- gh-comment-id:230527251 --> @Crocmagnon commented on GitHub (Jul 5, 2016): This issue still affects me as well. Any update on a fix ? 😃
Author
Owner

@Bohrbug commented on GitHub (Jul 6, 2016):

Same thing for programmer Dvorak. Would love to see fix. 😅

On Tue, Jul 5, 2016 at 6:19 PM, Gabriel Augendre notifications@github.com
wrote:

This issue still affects me as well. Any update on a fix ? 😃


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/keycastr/keycastr/issues/56#issuecomment-230527251,
or mute the thread
https://github.com/notifications/unsubscribe/AGo37VOPDhi_j6Zu6w6N_0v9XqGj9pcRks5qSoQCgaJpZM4Hrzcx
.

<!-- gh-comment-id:230699121 --> @Bohrbug commented on GitHub (Jul 6, 2016): Same thing for programmer Dvorak. Would love to see fix. 😅 On Tue, Jul 5, 2016 at 6:19 PM, Gabriel Augendre notifications@github.com wrote: > This issue still affects me as well. Any update on a fix ? 😃 > > — > You are receiving this because you are subscribed to this thread. > Reply to this email directly, view it on GitHub > https://github.com/keycastr/keycastr/issues/56#issuecomment-230527251, > or mute the thread > https://github.com/notifications/unsubscribe/AGo37VOPDhi_j6Zu6w6N_0v9XqGj9pcRks5qSoQCgaJpZM4Hrzcx > .
Author
Owner

@sdeken commented on GitHub (Sep 21, 2016):

Definitely a bug, I'll slate it for the 0.9.5 release and get it fixed

<!-- gh-comment-id:248486947 --> @sdeken commented on GitHub (Sep 21, 2016): Definitely a bug, I'll slate it for the 0.9.5 release and get it fixed
Author
Owner

@rawaludin commented on GitHub (Dec 9, 2016):

Same thing for Colemak user here :)

<!-- gh-comment-id:265910002 --> @rawaludin commented on GitHub (Dec 9, 2016): Same thing for Colemak user here :)
Author
Owner

@wincent commented on GitHub (Dec 9, 2016):

@rawaludin: See the links to my commits above. I've hacked around the issue on Colemak, although in a totally non-general way:

<!-- gh-comment-id:265917924 --> @wincent commented on GitHub (Dec 9, 2016): @rawaludin: See the links to my commits above. I've hacked around the issue on Colemak, although in a totally non-general way: - https://github.com/wincent/keycastr/commit/50479653c28815359d1f88973741dcfbb6483691 - https://github.com/wincent/keycastr/commit/100230f3a9a10554f218977b6e9ce9e872b9ce07
Author
Owner

@pierpo commented on GitHub (Apr 18, 2017):

Still having the issue when using azerty. Not with the alphanumeric characters, but with the special characters.

For example :

  • * is mismatched as }
  • % is mismatched as "
<!-- gh-comment-id:294939037 --> @pierpo commented on GitHub (Apr 18, 2017): Still having the issue when using azerty. Not with the alphanumeric characters, but with the special characters. For example : - `*` is mismatched as `}` - `%` is mismatched as `"`
Author
Owner

@akitchen commented on GitHub (Apr 18, 2017):

Thanks for trying it out. I would like to see if there's a way to map / decode these using native APIs as opposed to the hard-coded dictionary solution currently in place.

On Apr 18, 2017, at 11:31, Pierre Poupin notifications@github.com wrote:

Still having the issue when using azerty. Not with the alphanumeric characters, but with the special characters.

For example :

  • is mismatched as }
    % is mismatched as "

    You are receiving this because you are subscribed to this thread.
    Reply to this email directly, view it on GitHub, or mute the thread.
<!-- gh-comment-id:294959839 --> @akitchen commented on GitHub (Apr 18, 2017): Thanks for trying it out. I would like to see if there's a way to map / decode these using native APIs as opposed to the hard-coded dictionary solution currently in place. > On Apr 18, 2017, at 11:31, Pierre Poupin <notifications@github.com> wrote: > > Still having the issue when using azerty. Not with the alphanumeric characters, but with the special characters. > > For example : > > * is mismatched as } > % is mismatched as " > — > You are receiving this because you are subscribed to this thread. > Reply to this email directly, view it on GitHub, or mute the thread. >
Author
Owner

@serverwentdown commented on GitHub (Apr 20, 2017):

👍

For now, here's mappings for programmer Dvorak:
https://github.com/serverwentdown/keycastr/blob/master/keycastr/KCKeystrokeTransformer.m

<!-- gh-comment-id:295606192 --> @serverwentdown commented on GitHub (Apr 20, 2017): :+1: For now, here's mappings for programmer Dvorak: https://github.com/serverwentdown/keycastr/blob/master/keycastr/KCKeystrokeTransformer.m
Author
Owner

@akitchen commented on GitHub (Jul 31, 2017):

If anyone is interested in trying out this fix & providing feedback, please try out the build located here:

https://github.com/akitchen/keycastr/blob/master/keycastr/bin/KeyCastr.app.zip

<!-- gh-comment-id:319227296 --> @akitchen commented on GitHub (Jul 31, 2017): If anyone is interested in trying out this fix & providing feedback, please try out the build located here: https://github.com/akitchen/keycastr/blob/master/keycastr/bin/KeyCastr.app.zip
Author
Owner

@Crocmagnon commented on GitHub (Aug 2, 2017):

@akitchen, when I try to launch this version I get this error window
Error window

When I click on "Grant Access", it prompts me for my password, then exits and restarts the app with the same error window.

I'm using it on macOS Sierra 10.12.6 with a French AZERTY keyboard.

<!-- gh-comment-id:319652362 --> @Crocmagnon commented on GitHub (Aug 2, 2017): @akitchen, when I try to launch this version I get this error window ![Error window](https://www.dropbox.com/s/ip5wpxbudtwxm4w/Capture%20d%27%C3%A9cran%202017-08-02%2014.02.51.png?raw=1) When I click on "Grant Access", it prompts me for my password, then exits and restarts the app with the same error window. I'm using it on macOS Sierra 10.12.6 with a French AZERTY keyboard.
Author
Owner

@pierpo commented on GitHub (Aug 2, 2017):

@akitchen Works for me! Thanks :)

<!-- gh-comment-id:319675364 --> @pierpo commented on GitHub (Aug 2, 2017): @akitchen Works for me! Thanks :)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/keycastr#43
No description provided.