Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Win] Enhance OptSpecialChars dead keys processing #732

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

RedBearAK
Copy link
Contributor

@RedBearAK RedBearAK commented Jul 15, 2022

@rbreaves

For Windows/AHK:

Adds more accurate and intuitive behavior to the process of using dead keys, to match macOS more closely, and fixes some of the Switch/Case lines that weren't working as expected (Escape, Space were not actually activating).

Dead keys sequences will now place the pending diacritic accent character (e.g., umlaut [ ¨ ]) in a highlight, then either replace it with the full accented character (e.g., [ Ü ]) if there is a match, or deselect the diacritic character and exit the dead keys sequence, leaving the diacritic character visible. Any input other than Escape or Space or a matching letter will be passed through. This is a very close match for how dead keys work in macOS.

Also enabled the ability to interrupt a dead key sequence by triggering another dead key sequence, which like many other keys will just leave the original diacritic character visible and insert the new one in a highlight as the start of the new sequence. This behaves like it does on a Mac when you change your mind in the middle and do a different dead key.

[EDIT: Added Ctrl keys to break the dead keys sequence when switching away to another app. This also matches the macOS behavior when you task switch before completing the dead keys sequence.]

Previous PR by this name had some unforeseen issues with non-character-generating input editing keys like arrows, Backspace, and Delete, which were being ignored/disabled by the AHK Input command. And the uppercase accented characters were not working properly. All such issues are fixed here and thoroughly tested.

🤞🏽 😮‍💨 🤞🏽

For Windows/AHK: 

Adds more accurate and intuitive behavior to the process of using dead keys, to match macOS more closely, and fixes some of the Switch/Case lines that weren't working as expected (Escape, Space were not actually activating).

Dead keys sequences will now place the pending diacritic accent character (e.g., umlaut [ ¨ ]) in a highlight, then either replace it with the full accented character (e.g., [ Ü ]) if there is a match, or deselect the diacritic character and exit the dead keys sequence, leaving the diacritic character visible. Any input other than Escape or Space or a matching letter will be passed through. This is a very close match for how dead keys work in macOS.

Also enabled the ability to interrupt a dead key sequence by triggering another dead key sequence, which like many other keys will just leave the original diacritic character visible and insert the new one in a highlight as the start of the new sequence. This behaves like it does on a Mac when you change your mind in the middle and do a different dead key. 

Previous PR by this name had some unforeseen issues with non-character-generating input editing keys like arrows, Backspace, and Delete, which were being ignored/disabled by the AHK `Input` command. And the uppercase accented characters were not working properly. All such issues are fixed here and thoroughly tested. 

🤞🏽 😮‍💨 🤞🏽
@RedBearAK
Copy link
Contributor Author

Added support for exiting dead keys with appropriate actions for the arrow keys, mimicking what happens in macOS as closely as possible.

@Danilo-Araujo-Silva
Copy link

@RedBearAK, do you know if these modifications would also work for this configuration?

I'm having a hard time with a Magic Keyboard here on KDE ^^
Without the dead keys working is really annoying..

Operating System: Kubuntu 22.04
KDE Plasma Version: 5.24.7
KDE Frameworks Version: 5.92.0
Qt Version: 5.15.3
Kernel Version: 6.2.0-37-generic (64-bit)
Graphics Platform: X11
Processors: 8 × Intel® Core™ i7-6820HQ CPU @ 2.70GHz
Memory: 15.4 GiB of RAM
Graphics Processor: Mesa Intel® HD Graphics 530

@RedBearAK
Copy link
Contributor Author

@RedBearAK, do you know if these modifications would also work for this configuration?

I'm having a hard time with a Magic Keyboard here on KDE ^^ Without the dead keys working is really annoying..

Operating System: Kubuntu 22.04
KDE Plasma Version: 5.24.7
KDE Frameworks Version: 5.92.0
Qt Version: 5.15.3
Kernel Version: 6.2.0-37-generic (64-bit)
Graphics Platform: X11
Processors: 8 × Intel® Core™ i7-6820HQ CPU @ 2.70GHz
Memory: 15.4 GiB of RAM
Graphics Processor: Mesa Intel® HD Graphics 530

@Danilo-Araujo-Silva

There are several different aspects of the answer to this question.

  1. There are “Macintosh” keyboard variants that should enable the special characters and dead keys, independent of the keymapper config. You have to enable the setting in your desktop environment (and also the preference option in Kinto) to use a key like RIGHT_ALT as the Alt_Gr key, just like with other international keyboard layouts. Only that key will work, you won’t be able to use the key on the left side, the way you can in macOS.

  2. The keymapper may give unexpected characters if you are using a non-US keyboard layout. This can sometimes be fixed by editing the key definition file.

  3. Kinto uses xkeysnail, which has no support for Wayland or Unicode character sequences. A separate project of mine (Toshy) uses a fork of xkeysnail (keyszer) that has both, and can make the special characters available from both Option keys, just like macOS. But only the standard US and the “ABC Extended” special character layouts are available. So if you use a non-US layout some of the special characters or dead keys may be missing or in the wrong place. Unlike the built-in “Macintosh” layouts you may find in your desktop environment settings.

If you want to talk more about this, feel free to open an issue thread on the Toshy repo.

https://github.com/RedBearAK/toshy/issues/

@Danilo-Araujo-Silva
Copy link

@RedBearAK, thanks a lot for your quick and informative reply :)

I'm going to check your repo here o/ Uhuul

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