def remove(self, client: Window) -> Window | None:
        """
        Remove the given client from collection.
        """
        if client not in self.clients:
            return None
        idx = self.clients.index(client)
        del self.clients[idx]
        if len(self) == 0:
            self._current_idx = 0
        elif idx <= self._current_idx:
            self._current_idx = max(0, self._current_idx - 1)

        return self[self._current_idx]

        Remove the given client from collection.
        
libqtile/layout/base.py