Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OS key events (globalShortcut) #332

Open
R-Bower opened this issue Dec 30, 2020 · 3 comments
Open

OS key events (globalShortcut) #332

R-Bower opened this issue Dec 30, 2020 · 3 comments

Comments

@R-Bower
Copy link

R-Bower commented Dec 30, 2020

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
Copy link
Collaborator

a7ul commented Dec 30, 2020

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

@a7ul
Copy link
Collaborator

a7ul commented Dec 30, 2020

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

This should do it?

@R-Bower
Copy link
Author

R-Bower commented Dec 30, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants