wilix-team / iohook

Node.js global keyboard and mouse listener.
https://wilix-team.github.io/iohook
MIT License
1.2k stars 291 forks source link

Shortcuts registered with ioHook.registerShortcut still interact with the host OS (MacOS) #209

Open simonmetcalfe opened 4 years ago

simonmetcalfe commented 4 years ago

Shortcuts registered with ioHook.registerShortcut still interact with the host OS (MacOS), in addition to triggering the respective Electron event. E.g. CTRL + ALT + 1 will change the selected file in Finder if it's the selected window, and the Mac system warning beep may be heard.

Expected Behavior

The registered shortcuts should only fire an event within the Electron app (like globalShortcut does), and should not affect the OS.

Current Behavior

The shortcuts interact with the host OS (MacOS tested only) when they should not.

Possible Solution

Unknown

Steps to Reproduce (for bugs)

  1. Register a shortct, e.g. const ctrlAlt1 = ioHook.registerShortcut([29, 56, 2], (KEYS) => {//some function}
  2. Run the Electron app
  3. Open a Finder window and select a file other than the top one
  4. Press the shortcut
  5. Observe the file selection changes in addition to the Electron event being triggered

Context

I require some global shortcut keys for an Electron project, but the keys must not interact with the host OS (for obvious reasons).

Your Environment

256shadesofgrey commented 4 years ago

I have the same issue with Linux (Manjaro 19.0).

This seems to be related to https://github.com/wilix-team/iohook/issues/34 , https://github.com/wilix-team/iohook/pull/102 .