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
[Feature] Expose a way to add custom global keybinds from within a plugin #1609
Comments
you can use Discord's api for this: DiscordNative.nativeModules.requireModule("discord_utils").inputEventRegister(
1337,
[
[0, 0xA2], // LEFT CTRL
[0, 0x42], // B
],
isDown => console.log(isDown),
{
blurred: true,
focused: true,
keydown: true,
keyup: true
}
)
Obtain keycodes for each platform (you might or might not have to add const WindowsMappings = getModule(m => m.ctrl === 0xa2)
const LinuxMappings = getModule(m => m.ctrl === 0x25)
const MacMappings = getModule(m => m.ctrl === 0xe0) To unregister: DiscordNative.nativeModules.requireModule("discord_utils").inputEventUnregister(1337) |
Thanks! I can confirm this works. Though it isn't an official bd api I'll close this issue for now. If anyone comes up with a better solution in the future they can re-open. |
Definitely not a good reason to close imo as the original issue/feature here is not addressed |
Makes sense, I was under the impression that this was not a huge concern for BD. But I'm happy that it's still being considered an issue. |
Before Requesting
Describe the feature you'd like!
It would be nice if you could add the ability for a plugin to add/register custom keybinds that work globally (even if discord is not in focus), whether via exposing globalShortcut in require("electron") or by adding a wrapper of some kind that allows for adding custom global keybinds.
Anything else?
https://www.electronjs.org/docs/latest/tutorial/keyboard-shortcuts#global-shortcuts
The text was updated successfully, but these errors were encountered: