Skip to content

Conversation

@ahxxm
Copy link

@ahxxm ahxxm commented Sep 15, 2018

#44 mentioned: # synthesize text - does not work on Mojave (for now..)

this PR adds option -a to simplify configuration of keystroke-sequence, previously:

ctrl - j : skhd -k "1"; skhd -k "w"; skhd -k "2"; skhd -k "w"; skhd -k "3"; skhd -k "q"; skhd -k "e"; skhd -k "4"; skhd -k "e"; skhd -k "w"; skhd -k "q"

new:

ctrl - j : skhd -a "1w2w3qe4ewq"

@asmvik
Copy link
Owner

asmvik commented Sep 15, 2018

I don't want to be making any changes related to this until Mojave GM is released, as there is no indication in their documentation that any changes have been made to the API we use to implement this. As such, I believe this is just a bug or unintended change.

This feature also uses non-deprecated APIs which make my point above seem more valid.
If Mojave is released and this is still a problem,I will consider different ways to replicate said functionality (with utf8 support).

@ahxxm
Copy link
Author

ahxxm commented Sep 25, 2018

-t works here after upgrade to Mojave(10.14), but it works only in text area, didn't trigger keystroke as observed from Chrome tab..

@asmvik
Copy link
Owner

asmvik commented Sep 25, 2018

This is not working for me either. The part that has changed in Mojave is the following function call:
https://developer.apple.com/documentation/coregraphics/1456028-cgeventkeyboardsetunicodestring

It no longer appears to respect the override that we could do before.
As mentioned in the description (at the referenced page):

By default, the system translates the virtual key code in a keyboard event 
into a Unicode string based on the keyboard ID in the event source. 
This function allows you to manually override this string. 
Note that application frameworks may ignore the Unicode string in a keyboard 
event and do their own translation based on the virtual keycode and perceived event state.

Basically, we need to be able to do the reverse translation; find the virtual key code for the Unicode symbol, and set the virtual key code in the event instead.

I'm not sure at this moment how Unicode symbols are mapped into the virtual key code space.

@yigitkonur yigitkonur mentioned this pull request Mar 15, 2021
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