iohook icon indicating copy to clipboard operation
iohook copied to clipboard

Locking key combinations create false information

Open SirDavenport opened this issue 5 years ago • 0 comments

When using the 'keydown' event to capture a combination like 'ctrl alt del', the combination is captured, but when you come back from the lock screen, every event has ctrl and alt as true until you press the key again.

Expected Behavior

When coming back from the lock screen, the ctrl and alt key should not be true for the remainder of iohook.

Current Behavior

Pressing a combination of keys that locks the screen, like ctrl alt del, cause the ctrl and alt keys to be locked for future events until the ctrl or alt key are pressed.

Possible Solution

Add a method to index.js that can be called that resets the keys. I have tested this and it works. Just listen for special events that lock the computer and call this method when those combinations are hit. resetStuckSpecialKeys(){ this._handleCtrl({ctrlKey:true, type:'keyup'}) this._handleAlt({altKey:true, type:'keyup'}) this._handleMeta({metaKey:true, type:'keyup'}) this._handleShift({metaKey:true, type:'keyup'}) }

Steps to Reproduce (for bugs)

  1. With iohook started, and console logging keydown events, press ctrl + alt + delete (rawcode == 46)
  2. Come back from the lock screen.
  3. Press any key, for example, press 's'
  4. Look at the event

Context

When tracking keystrokes (legally), it is giving false positives if the user ever does a combination with locked keys.

Your Environment

  • Version used: "iohook": "^0.5.0"
  • Environment name and version (e.g. Chrome 39, node.js 5.4): "iohook": { "targets": [ "node-72", "electron-57" ], "platforms": [ "win32", "darwin", "linux" ], "arches": [ "x64", "ia32" ] }
  • Operating System and version (desktop or mobile): Windows 10

SirDavenport avatar Mar 03 '20 16:03 SirDavenport