Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def manage(self, w):
try:
attrs = w.get_attributes()
internal = w.get_property("QTILE_INTERNAL")
except (xcffib.xproto.WindowError, xcffib.xproto.AccessError):
return
if attrs and attrs.override_redirect:
return
if w.wid not in self.windows_map:
if internal:
try:
c = window.Internal(w, self)
except (xcffib.xproto.WindowError, xcffib.xproto.AccessError):
return
self.windows_map[w.wid] = c
else:
try:
c = window.Window(w, self)
except (xcffib.xproto.WindowError, xcffib.xproto.AccessError):
return
if not (wname or wmclass or role):
raise TypeError(
"Either a name, a wmclass or a role must be specified"
)
if wname and wname == self.name:
return True
try:
cliclass = self.window.get_wm_class()
if wmclass and cliclass and wmclass in cliclass:
return True
clirole = self.window.get_wm_window_role()
if role and clirole and role == clirole:
return True
except (xcffib.xproto.WindowError, xcffib.xproto.AccessError):
return False
return False
)
else:
type, _ = PropertyMap[prop]
try:
r = self.conn.conn.core.GetProperty(
False, self.wid,
self.conn.atoms[prop]
if isinstance(prop, str)
else prop,
self.conn.atoms[type]
if isinstance(type, str)
else type,
0, (2 ** 32) - 1
).reply()
except (xcffib.xproto.WindowError, xcffib.xproto.AccessError):
logger.warning(
'X error in GetProperty (wid=%r, prop=%r), ignoring',
self.wid, prop)
if unpack:
return []
return None
if not r.value_len:
if unpack:
return []
return None
elif unpack:
# Should we allow more options for unpacking?
if unpack is int:
return r.value.to_atoms()
elif unpack is str: