def get_spiral(self, x, y, width, height) -> list[Rect]:
        """
        Calculates positions of windows in the spiral.

        Returns a list of tuples (x, y, w, h) for positioning windows.
        """
        num_windows = len(self.clients)
        direction = 0
        spiral = []
        rect = (x, y, width, height)

        for c in range(num_windows):
            if c == 0 and self.main_pane_ratio is not None:
                self.split_ratio = self.main_pane_ratio
            else:
                self.split_ratio = self.ratio

            # If there's another window to draw after this one then we need to
            # split the current rect, if not, the window can take the full rect
            split = c < (num_windows - 1)
            if not split:
                spiral.append(rect)
                continue

            # Get the dimensions of the window and remaining rect
            # Calls self.split_[direction name]
            win, new_rect = getattr(self, f"split_{self.splits[direction]}")(rect)

            # If the window would have negative/zero dimensions then it can't be displayed
            if self.has_invalid_size(win):
                # Use the available rect from before the split
                spiral.append(rect)
                break

            spiral.append(win)

            direction = (direction + 1) % 4
            rect = new_rect

        return spiral

        Calculates positions of windows in the spiral.

        Returns a list of tuples (x, y, w, h) for positioning windows.
        
libqtile/layout/spiral.py