tomzx / gkm Goto Github PK
View Code? Open in Web Editor NEW⚠ Unsupported/Unmaintained ⚠️️ Global Keyboard and Mouse listener for node.js.
License: MIT License
⚠ Unsupported/Unmaintained ⚠️️ Global Keyboard and Mouse listener for node.js.
License: MIT License
I recently updated to jdk15.0.2 and realized that gmk stopped working for me. I did however find a workaround for this issue:
jnativehook-2.1.0.zip
and navigate to jnativehook\jar\jnativehook-2.1.0.jar
jnativehook-2.1.0.jar
to <project-path>\node_modules\gkm\lib\lib\
JNativeHook.jar
in <project-path>\node_modules\gkm\lib\lib\
jnativehook-2.1.0.jar
to JNativeHook.jar
I have yet to test this method with earlier versions of java.
Unicode list: à, á, ả, ã, ạ, ê, ề, ế, ệ,...
Lib is support it.
I tested on Mac OS and got OS freeze.
Hi There!
Is it possible to get mouse wheel events?
Unfortunately on mouse.* I don't see it in the logs of the event listener.
Thanks!
Is it possible to prevent that?
Is it possible to add a hook to remove all listeners?
It's quite useful in event handler:
process.on('exit'....
Hi,
I want to get the coordinate of cursor location of keyboard. It is different than mouse pointer location. Is there a way to extend gkm to achieve that?
Rgds
Please make everything transparent.
In "JNativeHook.jar" demo on Gkm's directory we can view mouse wheel's data, but even listen to every events on Gkm's module ( gkm.events.onAny(function(data) {console.log(this.event+' '+data);}); ) there is no mouse wheel's data =(. I checked gkm-java source and look to me that there is no emitter to JNativeHooks's "NativeMouseWheelListener", I don't know plenty Java and can be completely wrong.
Is this data available on Gkm.js? How can I help develop this functionality if there isn't?
Thank you for this package, It's the only one that satisfy my needs on Windows 10, and I realy want to only depends on it! English is not my mother tongue; please excuse any errors on my part =).
I was using GKM on my angular project and I already had a java. But once I remove and reinstall java, Gkm not working properly.How to resolve this issue.
I have tested simple code:
require("gkm").events.on("key.typed",console.log);
Output:
[ 'Undefined' ]
[ 'Undefined' ]
[ 'Undefined' ]
Node version: v8.6.0
NPM version: v5.3.0
java
version: 1.8.0_91
javac
version: 1.8.0_60
OS: Windows 7 (x64)
When I package up the application, if the user doesn't have Java installed gkm
won't run.
I've run into the same issue with gm
and have packaged a binary with Electron to distribute. I can then use their appPath
option to refer to the local gm instead of looking for a globally installed gm.
Here's the easiest place to check that out:
https://github.com/aheckmann/gm/blob/c1bef9d4fd21e34ef8138f44a85c342aeae1f174/lib/compare.js#L24
I was going to do the changes myself and create a pull request but I think it'll end up needing to change the way people need to implement gkm
in their project. What are your thoughts on this change?
JNativeHook has added the ability to attempt to consume native events, see docs page here.
This feature is currently listed as unsupported by the devs, because it doesn't work on some unix platforms, not sure if this library is designed to be crossplatform or not, but the ability to consume events would be very nice.
I got an error "Module not found: 'child_process'". What should I do? D:
(tested on Kubuntu 15)
Awesome module, but unfortunately every event includes a newline in the data field.
index.js
var gkm = require('gkm');
gkm.events.on('key.pressed', function (data) {
console.log('\'' + data + '\'')
console.log(this.event + ' ' + data);
});
output
'D
'
key.pressed D
Guess that's not intended, makes it much harder to work with at least.
The current version of jNativeHook (1.1.4) will stop working properly on Windows after some event (still unknown).
When it breaks, the OS global hotkeys such as F2 to edit a filename do not work anymore. The current only known fix is to reboot the machine.
Hi,
Can you make gkm.jar code transparent to debug?
This makes it look like certain keys are stuck and are always pressed.
This is especially bad if I want to respond to a key-combination like Alt+F1.
I can likely create a small repro case if this is not a known issue and is doubted, just let me know.
I also realized just now that maybe I can also create some kind of an abstraction to hide this issue, because genuine stuck/pressed keys repeatedly fire new key.pressed events, so if for about a second I don't get any of those, I can safely assume that its due to this bug and the key is in fact not pressed.
This can work, though of course it would be preferable that this is fixed somewhere upstream because this would introduce a noticeable lag on occasion when responding to a user releasing a key.
Somewhat off-topic, but I am also baffled by the lack of available and reliable global keyboard hooks for node.js. For a while I was using iohook
, until I realised that it doesn't at all work when two apps require it at once. It makes Windows OS freeze. That's a pretty big deal-breaker.
Now, gkm, this package, seems to work much better, but like I say above, it's not fully reliable. And it also seems to not be actively maintained? And yeah, maybe I can smooth out these rough edges and live with this, but I am perplexed as to what people actually use if/when they want to respond in Node to a global keyboard shortcut. Do people just never want to do that? Do they use something I am not aware of?
Can you publish the latest v0.3.0 to NPM? Currently "newest" version on NPM is v0.1.0 and this version doesn't support mouse wheel events. I had to manually replace gkm.jar
from the latest v0.3.0 release.
Hi there.
Was testing stuff out while making an app and noticed that events are not fired after the application was packaged.
Tested this with simple
gkm.events.on('key.*', function(data) {
console.log(data[0]);
});
and while unpackaged it works, after electron-packager it stops triggering all possible events.
Framework: electron
OS: MAC catalina 10.15.6
Package.json
"eventemitter2": "^6.4.4",
"gkm": "^0.2.0",
Error
TypeError: EventEmitter2 is not a constructor
at eval (webpack:///./node_modules/gkm/gkm.js?:9:14)
at Object../node_modules/gkm/gkm.js (/Users////dist_electron/index.js:1622:1)
at webpack_require (/Users///team-viewer/dist_electron/index.js:20:30)
at eval (webpack:///./src/background.js?:15:13)
at Module../src/background.js (/Users////dist_electron/index.js:3802:1)
at webpack_require (/Users////dist_electron/index.js:20:30)
at eval (webpack:///multi_./src/background.js?:1:18)
at Object.0 (/Users////dist_electron/index.js:3813:1)
at webpack_require (/Users////dist_electron/index.js:20:30)
at /Users///*/dist_electron/index.js:84:18
OS: raspbian (on raspberry pi 3 model b+)
java -version:
java version "1.8.0_65"
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) Client VM (build 25.65-b01, mixed mode)
javac -version: javac 1.8.0_65
command: java -jar gkm.jar
error:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x643640a4, pid=1116, tid=1982747760
#
# JRE version: Java(TM) SE Runtime Environment (8.0_65-b17) (build 1.8.0_65-b17)
# Java VM: Java HotSpot(TM) Client VM (25.65-b01 mixed mode linux-arm )
# Problematic frame:
# C [libX11.so.6+0x870a4] XkbGetUpdatedMap+0x4
#
# Core dump written. Default location: /home/pi/Desktop/startup/node_modules/gkm/lib/core or core.1116
#
# An error report file with more information is saved as:
# /home/pi/Desktop/startup/node_modules/gkm/lib/hs_err_pid1116.log
#
# If you would like to submit a bug report, please visit:
# http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Aborted (core dumped)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.