Plugin API: Assign hotkey

After registering a command, eg:

await joplin.commands.register({
			name: 'insertDate',

And creating a toolbar button to call the command:

		await joplin.views.toolbarButtons.create('insertDate', 'insertDate', ToolbarButtonLocation.EditorToolbar);

Is there any way I can use the API to assign a hotkey to this command, or more particularly, make a hotkey configurable in the preferences menu?

I see that when creating a menuItem, an accelerator can be specified, but not when creating a toolbarButton?

Thanks for the help

3 Likes

I also want to know how bind key to a toolbarbutton.

I exported keymap to keymap-desktop.json, and modified it as follow, and imported it, it works.

    {
    "command": "insertDate",
    "accelerator": "Alt+F6"
  }