Global keyboard shortcut event listeners #168
Replies: 2 comments 1 reply
-
This may be my ignorance and I may be out of the loop in regards to this but is there any other precedent for this besides Discord's use case? I'm not aware of any mainstream applications (even native desktop ones) that respond to keyboard events when idle in the background. Outside of this being a security risk like you mentioned, depending on the keys allowed, an application maintainer would be able to track a user's keystrokes, which is an invasion of that user's privacy. Even if the user trusts the application. |
Beta Was this translation helpful? Give feedback.
-
It is possible to set keyboard shortcuts system wide. What is the specific use case for which application? |
Beta Was this translation helpful? Give feedback.
-
Certain web applications would benefit from system-wide event listeners. For example, Discords has an Electron app that enables users to set up keybindings that can be listened to for features such as push to talk or mute switching. The user would set up a button of their choice (ex. q, e, pause, etc.), and every time that button is pressed—whether the application is in the background or foreground—that action would be triggered.
Since Discord is more like a companion app to playing video games with your friends, most of the time the application is in the background. As far as I know there is no way to allow web applications to listen to keyboard events when they are not in focus.
This is a scary API, I know, but that is why I think there needs to be a lot of requirements before using this API. I’m assuming you don’t want websites listening to any keyboard event they so choose. You could possibly require the website to use HTTPS. You could also require the user to accept a permission on either system-wide event listeners for any key or individual keys. I also think that having a PWA installed could also very well be a requirement.
I have also filed this at https://bugs.chromium.org/p/chromium/issues/detail?id=904479&can=2&q=proj-fugu&colspec=ID%20Pri%20M%20Stars%20ReleaseBlock%20Component%20Status%20Owner%20Summary%20OS%20Modified&sort=m
https://webwewant.fyi/wants/110/
Beta Was this translation helpful? Give feedback.
All reactions