You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi All, I have used robotn/gohook in my app by registering hook and consuming events - key down, key hold and key up
However I don't think I can write cross-platform application. Below is my explanation:
Gohook version (or commit ref): v0.40.0
Go version: 1.20
Gcc version: Apple clang version 14.0.0 (clang-1400.0.29.202)
As you can see, the right and left shift has no down event. Also the order of events is strange. Why hold before down?. The "a" key can't be read as standard "a", since the code is not byte 65, the spacebar has hex code 0x20, which is almost ok, but only in hold event. The left arrow should have hex value 0x25.
Actually there is no consistency in events and the values which are populated and attributes which are populated are misleading.
Since the gohook is suppose to be cross-platform, we should have also some cross-platform keystroke values.
Hi All, I have used robotn/gohook in my app by registering hook and consuming events - key down, key hold and key up
However I don't think I can write cross-platform application. Below is my explanation:
// The console output is
// when pressed spacebar
key hold: rawcode=49 rawcode=0x31 keycode=57 keycode=0x39 keychar=65535 keychar=0xffff
key down: rawcode=49 rawcode=0x31 keycode=0 keycode=0x0 keychar=32 keychar=0x20
key up: rawcode=49 rawcode=0x31 keycode=57 keycode=0x39 keychar=65535 keychar=0xffff
// when pressed key a
key hold: rawcode=0 rawcode=0x0 keycode=30 keycode=0x1e keychar=65535 keychar=0xffff
key down: rawcode=0 rawcode=0x0 keycode=0 keycode=0x0 keychar=97 keychar=0x61
key up: rawcode=0 rawcode=0x0 keycode=30 keycode=0x1e keychar=65535 keychar=0xffff
// when pressed left arrow
key hold: rawcode=123 rawcode=0x7b keycode=57419 keycode=0xe04b keychar=65535 keychar=0xffff
key down: rawcode=123 rawcode=0x7b keycode=0 keycode=0x0 keychar=28 keychar=0x1c
key up: rawcode=123 rawcode=0x7b keycode=57419 keycode=0xe04b keychar=65535 keychar=0xffff
// when pressed right shift (note missing down event)
key hold: rawcode=60 rawcode=0x3c keycode=54 keycode=0x36 keychar=65535 keychar=0xffff
key up: rawcode=60 rawcode=0x3c keycode=54 keycode=0x36 keychar=65535 keychar=0xffff
// when left shit pressed
key hold: rawcode=56 rawcode=0x38 keycode=42 keycode=0x2a keychar=65535 keychar=0xffff
key up: rawcode=56 rawcode=0x38 keycode=42 keycode=0x2a keychar=65535 keychar=0xffff
As you can see, the right and left shift has no down event. Also the order of events is strange. Why hold before down?. The "a" key can't be read as standard "a", since the code is not byte 65, the spacebar has hex code 0x20, which is almost ok, but only in hold event. The left arrow should have hex value 0x25.
Actually there is no consistency in events and the values which are populated and attributes which are populated are misleading.
Since the gohook is suppose to be cross-platform, we should have also some cross-platform keystroke values.
Just stick to some standards defined by bigger companies like Mozilla - https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode. Why not Microsoft or Apple? Because Mozilla had always web browsers in mind and try to write cross-platform software.
The text was updated successfully, but these errors were encountered: