I want to have a little Python program running in the background that monitors for certain shortkey presses (e.g. Ctrl Alt direction key). The idea is that these shortkeys can trigger various actions.Here is the beginnings of an attempt, but I honestly don't know what I'm doing:import Xlibimport Xlib.displaydef process_event(event):    keycode = event.detail    if event.type == Xlib.X.KeyPress:        print(keycode)def main():    # current display    display    = Xlib.display.Display()    rootWindow = display.screen().root    # catch keypress events    rootWindow.change_attributes(event_mask = Xlib.X.KeyPressMask)    keys = [10, 11]    for keycode in keys:        rootWindow.grab_key(            keycode,            Xlib.X.Mod1Mask, #Xlib.X.AnyModifier,            1,            Xlib.X.GrabModeAsync,            Xlib.X.GrabModeAsync        )    while True:        event = rootWindow.display.next_event()        process_event(event)if __name__ == '__main__':    main()
How can X11 shortkeys be captured by a Python program?
x11;python