boppreh / keyboard

Hook and simulate global keyboard events on Windows and Linux.
MIT License
3.77k stars 433 forks source link

is_modifier and keyboard.get_hotkey_names don't work with non-english names #516

Open Avasam opened 2 years ago

Avasam commented 2 years ago

Here "left shift" is called "maj".

>>> import keyboard
>>> keyboard.read_event(True)
KeyboardEvent(maj down)
>>> keyboard.is_modifier(keyboard.read_event(True).name)
False
>>> import keyboard
>>>keyboard.get_hotkey_name(['ctrl', 'maj', 'D'])
KeyboardEvent(maj down)
'ctrl+D+maj'

Workaround: manually use keycodes instead keyboard.is_modifier(keyboard.read_event(True).scan_code)