def unregister_hotkeys(): for mapping in Config.KEYMAP: callback = Config.KEYMAP[mapping] codes = mapping.split('-') mods = codes[:-1] key = codes[-1] # No key? if not key: print >> sys.stderr, "Could not map %s to %s" % (mapping, callback) continue # generate key code and mod mask... keycode = PROBE.generate_keycode(key) modmask = PROBE.generate_modmask(mods) # Tell X we want to hear about it when this key is pressed... try: PROBE.ungrab_key(keycode, modmask) except: print "Nada:", callback # And finally reset the dispatcher... State._DISPATCHER = {}
def register_hotkeys(): for mapping in Config.KEYMAP: callback = Config.KEYMAP[mapping] codes = mapping.split('-') mods = codes[:-1] key = codes[-1] # No key? if not key: print( 'Could not map %s to %s' % (mapping, callback), file = sys.stderr ) continue # generate key code and mod mask... keycode = PROBE.generate_keycode(key) modmask = PROBE.generate_modmask(mods) # Tell X we want to hear about it when this key is pressed... try: PROBE.grab_key(keycode, modmask) except: print('Nada:', callback) # Finally register the key with the dispatcher... State.register_hotkey(keycode, modmask, callback)