def _maximize_focused_secondary(self):
        "Maximize the 'non-maximized' focused secondary pane"

        # Return immediately if no self.group.screen
        # (this may happen when moving windows across screens.)
        if self.group.screen is None:
            return

        # If auto_maximize is off, return immediately.
        if not self.auto_maximize:
            return

        # if we have 1 or 2 panes, do nothing.
        if len(self.clients) < 3:
            return

        # Recalculate relative_sizes
        self.normalize(redraw=False)
        if len(self.relative_sizes) == 0:
            return

        # If the focused window (self.focused) is 0 (main pane), adjust
        # focused to work directly on the secondary pane windows.
        focused = max(1, self.focused)

        n = len(self.clients) - 2  # total shrinking clients
        # total size of collapsed secondaries
        collapsed_size = self.min_secondary_size * n
        nidx = max(0, focused - 1)  # focused size index
        # total height of maximized secondary
        maxed_size = self.group.screen.dheight - collapsed_size

        # Maximize if window is not already maximized.
        if (
            abs(self._get_absolute_size_from_relative(self.relative_sizes[nidx]) - maxed_size)
            >= self.change_size
        ):
            self._grow_secondary(maxed_size)
            self.group.layout_all()
Maximize the 'non-maximized' focused secondary pane
libqtile/layout/xmonad.py