go-astilectron icon indicating copy to clipboard operation
go-astilectron copied to clipboard

Implement global shortcuts

Open benebsiny opened this issue 2 years ago • 3 comments

Ctrl+Shift+I opens devtools by default in Electron. However, we must put w.OpenDevTools() to open the devtool in go-astilectron. Is it possible to make that combination key to open the devtools?

benebsiny avatar Jun 14 '23 15:06 benebsiny

You can add shortcuts using accelerators in your menu items.

However, in your case, you can also add a menu item having its role set to toggledevtools. This should add the proper shortcut automatically.

asticode avatar Jun 14 '23 16:06 asticode

It works, thanks!

This method seems unintuitive. Also, there's a menu bar on top (I don't need it). It would be great if this feature is wrapped as globalShortcut-like object.

benebsiny avatar Jun 14 '23 16:06 benebsiny

It seems like a good idea, I'll rename this issue and keep it open.

Feel free to submit a PR if you feel like implementing it 👍

asticode avatar Jun 15 '23 07:06 asticode