Skip to content

[Win] Enhance OptSpecialChars dead keys processing#732

Open
RedBearAK wants to merge 4 commits intorbreaves:masterfrom
RedBearAK:patch-59
Open

[Win] Enhance OptSpecialChars dead keys processing#732
RedBearAK wants to merge 4 commits intorbreaves:masterfrom
RedBearAK:patch-59

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

donaldguy added a commit to donaldguy/kinto that referenced this pull request Apr 26, 2025
…breaves#885 from, respectively: RedBear/patch-40 (via donaldguy/harmonize-724-and-719), RedBearAK/patch-59, RedBearAK/mac_numpad_feature (via  donaldguy/harmonize-744-and-724) & RedBearAK/patch-70

w/ menu order of OptSpecialChars, then Mac Numpad, then Media Arrows Fix
& kinto.ahk logic blocks in that same order.
donaldguy added a commit to donaldguy/kinto that referenced this pull request Apr 26, 2025
…#744, & rbreaves#867 from, respectively: RedBear/patch-46 (via donaldguy/661-on-forced-master), RedBear/patch-40 (via donaldguy/harmonize-724-and-719), RedBearAK/patch-59, RedBearAK/mac_numpad_feature (via  donaldguy/harmonize-744-and-724) & RedBearAK/patch-70

w/ menu order of OptSpecialChars, then Mac Numpad, then Media Arrows Fix
& kinto.ahk logic blocks in that same order.

(Grand)parents are:
- @^1    rbreaves/master@{2025-04-25 19:00} [= @^2^1 = @^3~4 = @^4~2 = @^5~3]       (bed5f37~..4a3bfe7)
- @^2^2  rbreaves#661: [Win] Enable Cmd+Grave (backtick) same application window switching  (3799224~..66ccab5)
  - @^2    ^^ fixed for force push of rbreaves/master on 2022-05-14                 (95e92b4)
- @^3    rbreaves#732: [Win] Enhance OptSpecialChars dead keys processing                   (2a65285~..dab20fd)
- @^4~^2 rbreaves#724: [Win] Optional fix for media arrow keys (new)                        (e3e912f~..cea4111)
  - @^4~    ^^ merge with rbreaves#719, choosing arrows fix after OptSpecialChars           (3d9670b)
- @^4^2  rbreaves#744: Mac Numpad Features                                                  (7f3c95e~..d0d0bd1)
  - @^4     ^^ merge with rbreaves#722+rbreaves#719, chosing numpad between arrows & chars          (b0ee59a)
- @^5    rbreaves#867: [Win] New Fixes for Finder Mods (2024-06)
donaldguy added a commit to donaldguy/kinto that referenced this pull request Apr 26, 2025
…#744, & rbreaves#867 from, respectively: RedBear/patch-46 (via donaldguy/661-on-forced-master), RedBear/patch-40 (via donaldguy/harmonize-724-and-719), RedBearAK/patch-59, RedBearAK/mac_numpad_feature (via  donaldguy/harmonize-744-and-724) & RedBearAK/patch-70

w/ menu order of OptSpecialChars, then Mac Numpad, then Media Arrows Fix
& kinto.ahk logic blocks in that same order.

Common branch point [except @^2^2] is (6aa5cc5, but in `windows/`):
7b3aba9: @^1~14 = @^2~15 = @^3~5 = @^4^1~15 = @^4^2~9 = @^5~17
> @^2^2 is common from @^2^2~2 = 648819f = 7b3aba9~20

(Grand)parents are:
- @^1    rbreaves/HEAD@{2025-04-25 19:00} [@^2^ = @^4^^ = @^5~3]    (7b3aba9~..4a3bfe7)
- @^2       vvv fixed for push -f of rbreaves/master on 2022-5-14   (95e92b4)
  - @^2^2  rbreaves#661: [Win] Enable Cmd+` same app window switching       (3799224~..66ccab5)
- @^3      rbreaves#732: [Win] Enhance OptSpecialChars dead keys processing (5bf0cc2~..f0c2c00)
- @^4       vvvv, chosing numpad between arrows & chars             (b0ee59a)
  - @^4^2  rbreaves#744: Mac Numpad Features                                (7f3c95e~..d0d0bd1)
  - @^4^1    vvv w/ rbreaves#719, choosing arrows fix after OptSpecialChars (3d9670b)
  - @^4^1^2 rbreaves#724: [Win] Optional fix for media arrow keys (new)     (e3e912f~..cea4111)
- @^5       rbreaves#867: [Win] New Fixes for Finder Mods (2024-06)         (8b8e399~..044017e)
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