Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def layout_all(self, warp=False):
"""Layout the floating layer, then the current layout.
If we have have a current_window give it focus, optionally moving warp
to it.
"""
if self.screen and self.windows:
with self.disable_mask(xcffib.xproto.EventMask.EnterWindow):
normal = [x for x in self.windows if not x.floating]
floating = [
x for x in self.windows
if x.floating and not x.minimized
]
screen = self.screen.get_rect()
if normal:
try:
self.layout.layout(normal, screen)
except Exception:
logger.exception("Exception in layout %s",
self.layout.name)
if floating:
self.floating_layout.layout(floating, screen)
if self.current_window and \
self.screen == self.qtile.current_screen:
self.qtile.update_gaps(strut, self.strut)
self.strut = strut
def handle_PropertyNotify(self, e): # noqa: N802
name = self.qtile.conn.atoms.get_name(e.atom)
if name in ("_NET_WM_STRUT_PARTIAL", "_NET_WM_STRUT"):
self.update_strut()
def __repr__(self):
return "Static(%r)" % self.name
class Window(_Window):
_window_mask = EventMask.StructureNotify | \
EventMask.PropertyChange | \
EventMask.EnterWindow | \
EventMask.FocusChange
# Set when this object is being retired.
defunct = False
def __init__(self, window, qtile):
_Window.__init__(self, window, qtile)
self._group = None
self.update_name()
# add to group by position according to _NET_WM_DESKTOP property
group = None
index = window.get_wm_desktop()
if index is not None and index < len(qtile.groups):
group = qtile.groups[index]
elif index is None:
transient_for = window.get_wm_transient_for()
win = qtile.windows_map.get(transient_for)
if not display_name:
raise QtileError("No DISPLAY set")
self.conn = xcbq.Connection(display_name)
self._display_name = display_name
# Because we only do Xinerama multi-screening,
# we can assume that the first
# screen's root is _the_ root.
self._root = self.conn.default_screen.root
self._root.set_attribute(
eventmask=(
xcffib.xproto.EventMask.StructureNotify
| xcffib.xproto.EventMask.SubstructureNotify
| xcffib.xproto.EventMask.SubstructureRedirect
| xcffib.xproto.EventMask.EnterWindow
| xcffib.xproto.EventMask.LeaveWindow
)
)
self._root.set_property(
"_NET_SUPPORTED", [self.conn.atoms[x] for x in xcbq.SUPPORTED_ATOMS]
)
wmname = "qtile"
self._supporting_wm_check_window = self.conn.create_window(-1, -1, 1, 1)
self._supporting_wm_check_window.set_property("_NET_WM_NAME", wmname)
self._supporting_wm_check_window.set_property(
"_NET_SUPPORTING_WM_CHECK", self._supporting_wm_check_window.wid
)
self._root.set_property(
"_NET_SUPPORTING_WM_CHECK", self._supporting_wm_check_window.wid
def hide(self):
self.screen = None
with self.disable_mask(xcffib.xproto.EventMask.EnterWindow |
xcffib.xproto.EventMask.FocusChange |
xcffib.xproto.EventMask.LeaveWindow):
for i in self.windows:
i.hide()
self.layout.hide()