Example #1
0
    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)
Example #2
0
File: tree.py Project: m-col/qtile
 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)
Example #3
0
    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)
Example #4
0
 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)
     ]
Example #5
0
 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 = {}
Example #6
0
    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 = {}
Example #7
0
    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)
Example #8
0
 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
Example #9
0
 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
Example #10
0
 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
Example #11
0
    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)
Example #12
0
    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
Example #13
0
 def finalize(self):
     Layout.finalize(self)
     if self._drawer is not None:
         self._drawer.finalize()
Example #14
0
 def info(self):
     d = Layout.info(self)
     d["clients"] = [c.name for c in self.clients]
     return d
Example #15
0
 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
Example #16
0
 def __init__(self):
     Layout.__init__(self)
     self.window = None
     self.focused = False
Example #17
0
 def clone(self, group):
     c = Layout.clone(self, group)
     c.root = _BspNode()
     c.current = c.root
     return c
Example #18
0
 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
Example #19
0
 def finalize(self):
     if self._panel:
         self._panel.kill()
     Layout.finalize(self)
     if self._drawer is not None:
         self._drawer.finalize()
Example #20
0
 def clone(self, group):
     c = Layout.clone(self, group)
     c.clients = []
     c.rectangles = self.rectangles
     return c
Example #21
0
 def __init__(self, **config):
     Layout.__init__(self, **config)
     self.add_defaults(Columns.defaults)
     self.columns = [_Column(self.split, self.insert_position)]
     self.current = 0
Example #22
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
Example #23
0
 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
Example #24
0
 def __init__(self, **config):
     self.layouts = {}
     Layout.__init__(self, **config)
     self.add_defaults(Slice.defaults)
     self._slice = Single()
Example #25
0
 def __init__(self, **config):
     Layout.__init__(self, **config)
     self.add_defaults(CustomStack.defaults)
     self.stacks = []
Example #26
0
 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
Example #27
0
 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
Example #28
0
 def clone(self, group):
     c = Layout.clone(self, group)
     c.columns = [_Column(self.split, self.insert_position)]
     return c
Example #29
0
 def layout(self, windows, screen):
     panel, body = screen.hsplit(self.panel_width)
     self._resize_panel(panel)
     Layout.layout(self, windows, body)
Example #30
0
 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
Example #31
0
 def clone(self, group):
     c = Layout.clone(self, group)
     c._focused = None
     c._panel = None
     c._tree = Root(self.sections)
     return c
Example #32
0
 def __init__(self, **config):
     Layout.__init__(self, **config)
     self.add_defaults(Bsp.defaults)
     self.root = _BspNode()
     self.current = self.root
Example #33
0
 def clone(self, group):
     res = Layout.clone(self, group)
     res._slice = self._slice.clone(group)
     res.fallback = self.fallback.clone(group)
     return res
Example #34
0
 def info(self):
     d = Layout.info(self)
     for layout in self._get_layouts():
         d[layout.name] = layout.info()
     return d