moses-palmer / pynput

Sends virtual input commands
GNU Lesser General Public License v3.0
1.77k stars 245 forks source link

Certain keys not being parsed correctly after upgrade to Ubuntu LTS 22.04 #499

Open nemwiz opened 1 year ago

nemwiz commented 1 year ago

Description After upgrading to the latest Ubuntu version, some of the keys stopped working. I've debugged a bit and it seems that the key is incorrectly parsed. See below for examples.

Platform and pynput version Ubuntu LTS 22.04 Python v 3.10.4 Pynput 1.7.6

To Reproduce Non working code

from pynput import keyboard

def hotkeys_pressed():
    print('Event triggered')

key_combinations = {'<ctrl>+<alt>+<page_up>': hotkeys_pressed}

with keyboard.GlobalHotKeys(key_combinations) as hotkey:
    hotkey.join()

After debugging, I've changed my hotkeys to this and it works. It seems that the canonical function returns incorrect value.

from pynput import keyboard

def hotkeys_pressed():
    print('Event triggered')

key_combinations = {'<ctrl>+<alt>+<65365>': hotkeys_pressed}

with keyboard.GlobalHotKeys(key_combinations) as hotkey:
    hotkey.join()
yusanshi commented 1 year ago

Same for me. '<f1>' not works while '<65470>' works.