# Path: pwm/ffi/xcb.py
# class XcbError(Exception):
# class Cookie:
# class Xcb:
#     def __init__(self, error):
#     def __str__(self):
#     def __init__(self, name, value):
#     def __getattr__(self, name):
#     def reply(self):
#     def check(self):
#     def __init__(self):
#     def __getattr__(self, name):
#         def request(func, *args, **kwargs):
#     def connect(self, display=None):
#     def mask(self, masks):
# 
# Path: pwm/ffi/xcb.py
# class XcbError(Exception):
#     def __init__(self, error):
#         self.error = error
# 
#     def __str__(self):
#         label = xcb.event_get_error_label(self.error.response_type)
#         return "{}, type {}, code {}, major {}, minor {}".format(
#             xcb.ffi.string(label).decode("UTF-8"),
#             self.error.response_type, self.error.error_code,
#             self.error.major_code, self.error.minor_code)
# 
# Path: pwm/keysyms.py



from collections import defaultdict
from pwm.ffi.xcb import xcb
from pwm.ffi.xcb import XcbError
from pwm.keysyms import keysyms, keysym_strings
import re
            xcb.core.grab_key_checked(True, wid,
                                      modifiers | mod, key,
                                      xcb.GRAB_MODE_ASYNC,
                                      xcb.GRAB_MODE_ASYNC).check()

        return True
    except XcbError:
        return False


def ungrab_key(wid, modifiers, key):
    """
    Ungrabs a key that was grabbed by ``grab_key``. Similarly, it will return
    True on success and False on failure.

    When ungrabbing a key, the parameters to this function should be
    *precisely* the same as the parameters to ``grab_key``.

    :param wid: A window identifier.
    :type wid: int
    :param modifiers: A modifier mask.
    :type modifiers: int
    :param key: A keycode.
    :type key: int
    :rtype: bool
    """
    try:
        for mod in TRIVIAL_MODS:
            xcb.core.ungrab_key_checked(key, wid, modifiers | mod).check()
        return True

# Path: pwm/ffi/xcb.py
# class XcbError(Exception):
# class Cookie:
# class Xcb:
#     def __init__(self, error):
#     def __str__(self):
#     def __init__(self, name, value):
#     def __getattr__(self, name):
#     def reply(self):
#     def check(self):
#     def __init__(self):
#     def __getattr__(self, name):
#         def request(func, *args, **kwargs):
#     def connect(self, display=None):
#     def mask(self, masks):
# 
# Path: pwm/ffi/xcb.py
# class XcbError(Exception):
#     def __init__(self, error):
#         self.error = error
# 
#     def __str__(self):
#         label = xcb.event_get_error_label(self.error.response_type)
#         return "{}, type {}, code {}, major {}, minor {}".format(
#             xcb.ffi.string(label).decode("UTF-8"),
#             self.error.response_type, self.error.error_code,
#             self.error.major_code, self.error.minor_code)
# 
# Path: pwm/keysyms.py



# Path: pwm/keybind.py
from collections import defaultdict
from pwm.ffi.xcb import xcb
from pwm.ffi.xcb import XcbError
from pwm.keysyms import keysyms, keysym_strings
import re

            xcb.core.grab_key_checked(True, wid,
                                      modifiers | mod, key,
                                      xcb.GRAB_MODE_ASYNC,
                                      xcb.GRAB_MODE_ASYNC).check()

        return True
    except XcbError:
        return False


def ungrab_key(wid, modifiers, key):
    """
    Ungrabs a key that was grabbed by ``grab_key``. Similarly, it will return
    True on success and False on failure.

    When ungrabbing a key, the parameters to this function should be
    *precisely* the same as the parameters to ``grab_key``.

    :param wid: A window identifier.
    :type wid: int
    :param modifiers: A modifier mask.
    :type modifiers: int
    :param key: A keycode.
    :type key: int
    :rtype: bool
    """
    try:
        for mod in TRIVIAL_MODS:
            xcb.core.ungrab_key_checked(key, wid, modifiers | mod).check()
        return True

    except XcbError: