def __grabHotkey(self, key, modifiers, window):
logger.debug("<STR_LIT>", modifiers, key)<EOL>try:<EOL><INDENT>keycode = self.__lookupKeyCode(key)<EOL>mask = <NUM_LIT:0><EOL>for mod in modifiers:<EOL><INDENT>mask |= self.modMasks[mod]<EOL><DEDENT>window.grab_key(keycode, mask, True, X.GrabModeAsync, X.GrabModeAsync)<EOL>if Key.NUMLOCK in self.modMasks:<EOL><INDENT>window.grab_key(keycode, mask|self.modMasks[Key.NUMLOCK], True, X.GrabModeAsync, X.GrabModeAsync)<EOL><DEDENT>if Key.CAPSLOCK in self.modMasks:<EOL><INDENT>window.grab_key(keycode, mask|self.modMasks[Key.CAPSLOCK], True, X.GrabModeAsync, X.GrabModeAsync)<EOL><DEDENT>if Key.CAPSLOCK in self.modMasks and Key.NUMLOCK in self.modMasks:<EOL><INDENT>window.grab_key(keycode, mask|self.modMasks[Key.CAPSLOCK]|self.modMasks[Key.NUMLOCK], True, X.GrabModeAsync, X.GrabModeAsync)<EOL><DEDENT><DEDENT>except Exception as e:<EOL><INDENT>logger.warning("<STR_LIT>", modifiers, key, str(e))<EOL><DEDENT>
Grab a specific hotkey in the given window