zenangst / KeyboardCowboy

:keyboard: The missing keyboard shortcut utility for macOS
Other
655 stars 14 forks source link

Language agnostic keyboard shortcuts #504

Open amatoenot opened 4 months ago

amatoenot commented 4 months ago

It would be nice to have language-agnostic keyboard shortcuts. It seems all other system shortcuts work with key codes instead of actual symbols, so the input source doesn't matter, which is not the case with the Keyboard Cowboy. Currently, as a workaround, I have to duplicate actions to have shortcuts working in both languages.

image
zenangst commented 2 months ago

Hey @amatoenot, unsure how you would make this agnostic as the underlying key codes sent by the keys varies depending on which layout you are using.

Could you elaborate how this would work in practice?

amatoenot commented 2 months ago

Hi @zenangst, Not sure exactly. Afaik keyboard key HID is the same for any language. So maybe it's possible to create shortcuts mapped to the key HID somehow. Most of the default mac os shortcuts work this way (e.g. 'CMD + C key' copies in any language)

zenangst commented 2 months ago

I haven't found any information about HID related information on CGEvent's (which we are using to identify events).

https://developer.apple.com/documentation/coregraphics/cgeventfield

amatoenot commented 2 months ago

What about CGEventField.keyboardEventKeycode? Sounds like something that can be used to identify key instead of a character.

https://developer.apple.com/documentation/coregraphics/cgeventfield/keyboardeventkeycode

zenangst commented 2 months ago

That is what is used to identify it today, but the current input source send different key codes for different keys depending on the layout.