nodegui/react-nodegui

OS key events (globalShortcut)

R-Bower opened this issue · 3 comments

Is your feature request related to a problem? Please describe.
The react-nodegui instance can't detect key events when the application doesn't have focus.

Describe the solution you'd like
Detect keyboard events when the application does not have keyboard focus (similar to electron's globalShortcut)

Describe alternatives you've considered

  • Using a local redis store for storing and responding to OS events.
  • Mapping a keyboard shortcut to a process that starts the react-nodegui application.
a7ul commented

Can you see if there are any existing node module that does this already ?

https://www.npmjs.com/package/iohook

This should do it?

import iohook from "iohook"
then, when I npm run dev

Critical dependency: the request of a dependency is an expression
 @ multi webpack/hot/poll?100 ./src/index.js

npm start fails with:
Error: Cannot find module '/builds/node-v83-linux-x64/build/Release/iohook.node'

I've also tried adding iohook to the webpack config's externals, like so:
externals: {iohook: "iohook"},

But this fails on npm start with

module.exports = iohook;
                 ^
ReferenceError: iohook is not defined