Open 0xGosu opened 1 year ago
Tested with a Macbook Air M1 2020 model using latest Mac OS Ventura. Please merge with Squash commit when complete the review. Thanks!
command key is ok, but option key are still error.
Mac OS Ventura 13.5.1 on MacBook Pro M2 Pro, still got “KeyboardEvent(Unknown 1 down)”, event.name is None
Mac OS Ventura 13.5.1 on MacBook Pro M2 Pro, still got “KeyboardEvent(Unknown 1 down)”, event.name is None
But I can distinguish keyboard event by str(event) thought the event.name is still None. Anyway, thanks to your pr!
key_event = keyboard.read_event()
if key_event.event_type == keyboard.KEY_DOWN:
if str(key_event) == "KeyboardEvent(shift down)":
print("press 'left shift'")
elif str(key_event) == "KeyboardEvent(right shift down)":
print("press 'left shift'")
if paused:
if str(key_event) == "KeyboardEvent(Unknown 34 down)":
print("press 'i'")
elif str(key_event) == "KeyboardEvent(Unknown 40 down)":
print("press 'k'")
elif str(key_event) == "KeyboardEvent(Unknown 38 down)":
print("press 'j'")
elif str(key_event) == "KeyboardEvent(Unknown 37 down)":
print("press 'l'")
[fix bug for Mac OS Ventura where value of event.name is None] Add a default layout for mac OS incase unable to detect the layout key code automatically