keyboard icon indicating copy to clipboard operation
keyboard copied to clipboard

major issue with modifiers getting stuck when pressing CTRL or ALT on its own (Windows)

Open MuzzyGH opened this issue 3 years ago • 3 comments

Similiar issue has been reported by multiple users, but I'm creating a new one, as the one described here did not report any useful details.

ISSUE 1.1

CTRL is not released when the following contitions are met:

  • a hotkey with suppress=True is registered
  • the hotkey includes CTRL, e.g. CTRL+A
  • CTRL is pressed on its own (or CTRL + ALT GR).

CODE

import keyboard

def on_hotkey():
    print('test')

keyboard.add_hotkey('ctrl+a', on_hotkey, suppress=True)

keyboard.wait()

RESULT

Pressing and releasing CTRL in this example creates the following sequence of events:

CTRL (0xa2) is pressed (256) > CTRL (0xa2) is released (257) > CTRL (0xa2) is pressed (256)

leaving CTRL permanently pressed

ISSUE 1.2

NB There is an analogous situation when you register an ALT-containing hotkey with ALT getting stuck:

ALT (0xa4) is pressed (260) > ALT (0xa4) is released (257) > ALT (0xa4) is pressed (260)

MuzzyGH avatar Apr 18 '21 09:04 MuzzyGH