def __init__(self, float_rules=None, no_reposition_match=None, **config): """ If you have certain apps that you always want to float you can provide ``float_rules`` to do so. ``float_rules`` is a list of dictionaries containing some or all of the keys:: {'wname': WM_NAME, 'wmclass': WM_CLASS, 'role': WM_WINDOW_ROLE} The keys must be specified as above. You only need one, but you need to provide the value for it. When a new window is opened it's ``match`` method is called with each of these rules. If one matches, the window will float. The following will float gimp and skype:: float_rules=[dict(wmclass="skype"), dict(wmclass="gimp")] Specify these in the ``floating_layout`` in your config. Floating layout will try to center most of floating windows by default, but if you don't want this to happen for certain windows that are centered by mistake, you can use ``no_reposition_match`` option to specify them and layout will rely on windows to position themselves in correct location on the screen. """ Layout.__init__(self, **config) self.clients = [] self.focused = None self.group = None self.float_rules = float_rules or DEFAULT_FLOAT_RULES self.no_reposition_match = no_reposition_match self.add_defaults(Floating.defaults)
def layout(self, windows, screen_rect): if self.place_right: body, panel = screen_rect.hsplit(screen_rect.width - self.panel_width) else: panel, body = screen_rect.hsplit(self.panel_width) self._resize_panel(panel) Layout.layout(self, windows, body)
def __init__(self, float_rules=None, **config): Layout.__init__(self, **config) self.clients = [] self.focused = None self.group = None self.no_reposition_rules = [] #useless self.add_defaults(Floating2.defaults)
def __init__(self, **config): Layout.__init__(self, **config) self.add_defaults(Stack.defaults) if self.num_stacks <= 0: # Catch stupid mistakes early and generate a useful message raise ValueError("num_stacks must be at least 1") self.stacks = [ _WinStack(autosplit=self.autosplit) for i in range(self.num_stacks) ]
def __init__(self, **config): Layout.__init__(self, **config) self.add_defaults(TreeTab.defaults) self._focused = None self._panel = None self._drawer = None self._layout = None self._tree = Root(self.sections) self._nodes = {}
def __init__(self, **config): Layout.__init__(self, **config) self.add_defaults(Stack.defaults) self.stacks = [ _WinStack(autosplit=self.autosplit) for i in range(self.num_stacks) ] self.qtile = None self.previews = {}
def __init__(self, float_rules=None, no_reposition_rules=None, **config): """ If you have certain apps that you always want to float you can provide ``float_rules`` to do so. ``float_rules`` are a list of Match objects:: from libqtile.config import Match Match(title=WM_NAME, wm_class=WM_CLASS, role=WM_WINDOW_ROLE) When a new window is opened its ``match`` method is called with each of these rules. If one matches, the window will float. The following will float GIMP and Skype:: from libqtile.config import Match float_rules=[Match(wm_class="skype"), Match(wm_class="gimp")] Specify these in the ``floating_layout`` in your config. Floating layout will try to center most of floating windows by default, but if you don't want this to happen for certain windows that are centered by mistake, you can use ``no_reposition_rules`` option to specify them and layout will rely on windows to position themselves in correct location on the screen. """ Layout.__init__(self, **config) self.clients = [] self.focused = None self.group = None if float_rules is None: float_rules = self.default_float_rules else: warned = False for index, rule in enumerate(float_rules): if isinstance(rule, Match): continue if not warned: message = "Non-config.Match objects in float_rules are " \ "deprecated" warnings.warn(message, DeprecationWarning) logger.warning(message) warned = True match = Match(title=rule.get("wname"), wm_class=rule.get("wmclass"), role=rule.get("role"), wm_type=rule.get("wm_type"), wm_instance_class=rule.get("wm_instance_class"), net_wm_pid=rule.get("net_wm_pid")) float_rules[index] = match self.float_rules = float_rules self.no_reposition_rules = no_reposition_rules or [] self.add_defaults(Floating.defaults)
def clone(self, group): clone = Layout.clone(self, group) # These are mutable clone.stacks = [ _WinStack(autosplit=self.autosplit[i]) for i in range(len(self.stacks)) ] return clone
def clone(self, group): c = Layout.clone(self, group) # These are mutable c.stacks = [ _MyWinStack(autosplit=self.autosplit, width=s.width) for s in self.stacks ] return c
def info(self): d = Layout.info(self) d["clients"] = [] d["columns"] = [] for c in self.columns: cinfo = c.info() d["clients"].extend(cinfo['clients']) d["columns"].append(cinfo) d["current"] = self.current return d
def __init__(self, float_rules: Optional[List[Match]] = None, no_reposition_rules=None, **config): """ If you have certain apps that you always want to float you can provide ``float_rules`` to do so. ``float_rules`` are a list of Match objects:: from libqtile.config import Match Match(title=WM_NAME, wm_class=WM_CLASS, role=WM_WINDOW_ROLE) When a new window is opened its ``match`` method is called with each of these rules. If one matches, the window will float. The following will float GIMP and Skype:: from libqtile.config import Match float_rules=[Match(wm_class="skype"), Match(wm_class="gimp")] The following ``Match`` will float all windows that are transient windows for a parent window: Match(func=lambda c: bool(c.is_transient_for())) Specify these in the ``floating_layout`` in your config. Floating layout will try to center most of floating windows by default, but if you don't want this to happen for certain windows that are centered by mistake, you can use ``no_reposition_rules`` option to specify them and layout will rely on windows to position themselves in correct location on the screen. """ Layout.__init__(self, **config) self.clients: List[Window] = [] self.focused = None self.group = None if float_rules is None: float_rules = self.default_float_rules self.float_rules = float_rules self.no_reposition_rules = no_reposition_rules or [] self.add_defaults(Floating.defaults)
def info(self): def show_section_tree(root): """ Show a section tree in a nested list, whose every element has the form: `[root, [subtrees]]`. For `[root, [subtrees]]`, The first element is the root node, and the second is its a list of its subtrees. For example, a section with below windows hierarchy on the panel: - a - d - e - f - b - g - h - c will return [ [a, [d, [e]], [f]], [b, [g], [h]], [c], ] """ tree = [] if isinstance(root, Window): tree.append(root.window.name) if root.expanded and root.children: for child in root.children: tree.append(show_section_tree(child)) return tree d = Layout.info(self) d["clients"] = sorted([x.name for x in self._nodes]) d["sections"] = [x.title for x in self._tree.children] trees = {} for section in self._tree.children: trees[section.title] = show_section_tree(section) d["client_trees"] = trees return d
def finalize(self): Layout.finalize(self) if self._drawer is not None: self._drawer.finalize()
def info(self): d = Layout.info(self) d["clients"] = [c.name for c in self.clients] return d
def __init__(self, rectangles=[((0,0),(1,1))], **config): Layout.__init__(self, **config) self.add_defaults(StaticRectangles.defaults) self.rectangles = rectangles self.clients = [] self.focused = None
def __init__(self): Layout.__init__(self) self.window = None self.focused = False
def clone(self, group): c = Layout.clone(self, group) c.root = _BspNode() c.current = c.root return c
def clone(self, group): res = Layout.clone(self, group) res._slice = self._slice.clone(group) res._fallback = self._fallback.clone(group) res._window = None return res
def finalize(self): if self._panel: self._panel.kill() Layout.finalize(self) if self._drawer is not None: self._drawer.finalize()
def clone(self, group): c = Layout.clone(self, group) c.clients = [] c.rectangles = self.rectangles return c
def __init__(self, **config): Layout.__init__(self, **config) self.add_defaults(Columns.defaults) self.columns = [_Column(self.split, self.insert_position)] self.current = 0
def clone(self, group): c = Layout.clone(self, group) # These are mutable c.stacks = [_WinStack(autosplit=self.autosplit) for i in self.stacks] return c
def __init__(self, **config): Layout.__init__(self, **config) self.add_defaults(Plasma.defaults) self.root = Node(None, *self.default_dimensions) self.focused = None self.add_mode = None
def __init__(self, **config): self.layouts = {} Layout.__init__(self, **config) self.add_defaults(Slice.defaults) self._slice = Single()
def __init__(self, **config): Layout.__init__(self, **config) self.add_defaults(CustomStack.defaults) self.stacks = []
def info(self): d = Layout.info(self) d["stacks"] = [i.info() for i in self.stacks] d["current_stack"] = self.current_stack_offset d["clients"] = [c.name for c in self.clients] return d
def info(self): d = Layout.info(self) d["clients"] = [x.name for x in self._nodes] d["sections"] = [x.title for x in self._tree.children] return d
def clone(self, group): c = Layout.clone(self, group) c.columns = [_Column(self.split, self.insert_position)] return c
def layout(self, windows, screen): panel, body = screen.hsplit(self.panel_width) self._resize_panel(panel) Layout.layout(self, windows, body)
def info(self): d = Layout.info(self) d["rectangles"] = [rect for rect in self.rectangles] d["focused"] = self.focused d["clients"] = [x.name for x in self.clients] return d
def clone(self, group): c = Layout.clone(self, group) c._focused = None c._panel = None c._tree = Root(self.sections) return c
def __init__(self, **config): Layout.__init__(self, **config) self.add_defaults(Bsp.defaults) self.root = _BspNode() self.current = self.root
def clone(self, group): res = Layout.clone(self, group) res._slice = self._slice.clone(group) res.fallback = self.fallback.clone(group) return res
def info(self): d = Layout.info(self) for layout in self._get_layouts(): d[layout.name] = layout.info() return d