Skip to content

Conversation

nicola02nb
Copy link

@nicola02nb nicola02nb commented Aug 18, 2025

  • Added keybind setting type OptionType.KEYBIND with the related new component Keybinds.tsx(custom version of the original component).
  • Added keybindManager.ts api to register and manage global shortcuts.
  • Added an obligatory global property to set to return discord keyCode if true, else the KeyboardEvent.key.
  • Added keybinds management for global keybinds DiscordUtils
  • Added keybinds management for window keybinds window.addeventlistener()
  • Added ShortcutScrenshareScreen plugin that uses the globalKeybinds as an example.

Input support:

Global (DiscordNative) Window (window.addeventlistener())
Keyboard ✅(By using KeyboardEvent.key there is no left/right difference for ctrl, shift, alt, meta)
Mouse ➖ Partial (Mouse 0,3,4 won't work)
Gamepad ❌ Atm cannot get GamepadEvent to trigger

Web Extension:

In web extension the global keybinds will be disabled and cannot be bound

Other consideration:

  • Adding tabs into plugins settings dedicated for keybinds (which can be done also for commands) where you can add/remove them, edit the related keys that triggers them and the related function to call... like it's done in discord settings; so users are not obligated to have the keybinds enabled (or also the commands).

How to use:

Plugin Start

Atm you can also add to the plugin definition some the events with the related function to call:

keybinds: [
        { event: "startStreaming", global: true, function: startStreaming, options: { blurred: false, focused: false, keydown: true, keyup: false } },
		{ event: "testKeybind", global: false, function: testKeybind, options: { keydown: true, keyup: false } },
       	....
    ],

that adds on the plugin start the events names to the KeybindManager with the associated function to call using registerKeybind(), and then enables it usingenableKeybind() if in the plugin settings exists a setting named with the same name of the event.

Setting Update

Settings updates automatically on states changes of the KEYBIND setting component in Keybinds.tsx

Plugin Stop

On plugin stop, all keybinds will be unregisterd using disableKeybind(), and also the events will be unregistered using unregisterKeybind()

…sktop app and Vesktop version implementation
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.

1 participant