parro-it / electron-localshortcut

Add keyboard shortcuts locally to a BrowserWindow instance, without using a Menu
MIT License
422 stars 38 forks source link

Prevent default event action #69

Open fxha opened 6 years ago

fxha commented 6 years ago

I noticed you are using the before-input-event event to listen for shortcuts. Would it be possible to prevent the default action by reading the result from the callback function?

https://github.com/parro-it/electron-localshortcut/blob/3fbd63a6b3ca22368b218ecd39081c0d77d51ddc/index.js#L135

Exactly in this place and call e.preventDefault() if the result is true.

TimoKunze commented 5 years ago

Yes, would be great.

parro-it commented 5 years ago

Yes, I think too it should be useful. I'll add this in a future version. Or would you mind to write a PR?

fxha commented 5 years ago

@parro-it I'll create a PR for this from my fork in the next days.

parro-it commented 5 years ago

thank you!