-
Notifications
You must be signed in to change notification settings - Fork 15.5k
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
globalShortcuts don't work for alternate keyboards on Mac 10.14.6 #19747
Comments
I have the same problem. So I replaced global shortcuts with App-specific shortcuts using a library 'Mousetrap'. Works great for me. |
There are quite a few keys that can't be captured with Mousetrap (like function keys) or other renderer-based libraries, so that's not always an option. |
In case it is useful, one more data point from #26907: |
Alright, so I did a deep dive on this issue. 🧠💥 First, this particular issue did not work in 3.1.13 and never has. Issue #26907 is not exactly the same as this issue, and the two are basically unrelated aside from both being about the codebase assuming a standard US keyboard layout. (I believe the issue #26907 describes possibly did regress between v3 and v4; it's just not the same as this issue, that is all.) As for this issue, I found that there is pretty much only 1 API on macOS for registering "global hot keys" (aka global keyboard shortcuts)1. That API is named What I'm getting at here is that I don't think this issue can be solved at present. I could not find an API flexible enough to support anything beyond listening for specific key codes (physical keys) everywhere on the system. I think the functionality here is definitely desirable, but I cannot figure out how to make it possible right now. 😕 I didn't search very hard for other apps, but I tested the one other application on my system that has a global keyboard shortcut (it's not Electron-based) and it also suffered this issue. Edit: anyone who knows their way around macOS APIs is free to @ me and tell me I'm wrong. And I'd love to hear that! I simply did not get anywhere with my own search for a solution here. Notes
|
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment! |
bump
|
How to fix it? KeyCode is deprecated, code return physical key, so it's not working properly. Any ideas? |
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment! |
bump, it's still an issue |
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment! |
bump, it's still an issue |
bump, it's still an issue. I tried to configure Ctrl+0 as a hotkey on hungarian keyboard layout. If I pressed 0 I got backquote. I tried to change layout on linux (Ubuntu) with following command:
And now it is working with Ctrl+0 I'm not sure why the app is not using the user's keyboard layout by default... |
Expected Behavior
globalShortcuts work regardless of the chosen keyboard layout
Actual Behavior
On Mac, globalShortcuts seem to default to either qwerty or the keyboards layout (I think? I don't have a dvorak keyboard) rather than the chosen keyboard layout.
To Reproduce
Here's a fiddle that I tested on all three platforms. Windows works perfectly, Linux work with a caveat that it doesn't pick up keyboard changes made while the app is running, and Mac is broken.
https://gist.github.com/Kilian/995123ef2e31d6d15ee147a613831bed
To test this, add dvorak to your keyboard layouts. If set to Dvorak, the
l
is in the position of thep
on a qwerty layout. If you pressctrl + p
on a physical qwerty keyboard but are using the dvorak layout that should correspond toctrl + l
and pressing it should give a console.log in fiddle.The text was updated successfully, but these errors were encountered: