# 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
# Copyright (c) 2013 Michael Bitzi
# Licensed under the MIT license http://opensource.org/licenses/MIT



#
# Based on xpybutil
# https://github.com/BurntSushi/xpybutil/blob/master/xpybutil/keybind.py
#

__kbmap = None
__keysmods = None

__keybinds = defaultdict(list)

TRIVIAL_MODS = [
    0,
    xcb.MOD_MASK_LOCK,
    xcb.MOD_MASK_2,
    xcb.MOD_MASK_LOCK | xcb.MOD_MASK_2
]



# 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

# Copyright (c) 2013 Michael Bitzi
# Licensed under the MIT license http://opensource.org/licenses/MIT



#
# Based on xpybutil
# https://github.com/BurntSushi/xpybutil/blob/master/xpybutil/keybind.py
#

__kbmap = None
__keysmods = None

__keybinds = defaultdict(list)

TRIVIAL_MODS = [
    0,
    xcb.MOD_MASK_LOCK,
    xcb.MOD_MASK_2,
    xcb.MOD_MASK_LOCK | xcb.MOD_MASK_2
]



def strip_trivial(mods):