Extract key listener
Closed this issue · 2 comments
fregante commented
It doesn't look like there's a reliable global keypress handler for Node. iohook
crashes on macOS. I had to use Electron just for that.
Would it be possible to extract the keyboard listener component into its own npm module? Like iohook
but just for macOS
Amazing little app by the way!
karaggeorge commented
Hey, the listener and the UI are both written in swift. All the node.js code does is call the binary with the right args. How would you expect the listener to work in Node.js? Some kind of event emitter?
fregante commented
Yes, however I realized that your library does not capture the pressed key, so its use might be further limited (still useful though!)
It could either listen for any key or listen for a specific combination:
.onKeydown(handler)
.onKeydown('cmd+a', handler)