rbreaves / kinto

Mac-style shortcut keys for Linux & Windows.
http://kinto.sh
GNU General Public License v2.0
4.25k stars 213 forks source link

[Win] Enhance OptSpecialChars dead keys processing #732

Open RedBearAK opened 1 year ago

RedBearAK commented 1 year ago

@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.

🤞🏽 😮‍💨 🤞🏽

RedBearAK commented 1 year ago

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 commented 7 months ago

@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 commented 7 months ago

@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 commented 7 months ago

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

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