Skip to content

Commit

Permalink
docs(layout): clear up docs on Layout.clone()
Browse files Browse the repository at this point in the history
  • Loading branch information
aravinda0 committed Dec 23, 2023
1 parent cb97d0f commit a747abc
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/qtile_bonsai/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,14 +167,19 @@ def focused_pane(self) -> Pane | None:

def clone(self, group):
"""In the manner qtile expects, creates a fresh, blank-slate instance of this
class. `Group` instances will invoke this to get fresh, unique instance of this
layout for themselves.
class.
This is a bit different from traditional copying/cloning of any 'current' state
of the layout instance. In qtile, the config file holds the 'first' instance of
the layout, then each Group instance 'clones' of that original instance (which
likely remains in its initial state) and uses the new instance for all future
operations.
All the built-in layouts perform a state-resetting in their `clone()`
implementations.
So in practice, qtile treats the `Layout.clone()` method more like a factory
method, to create fresh instances.
"""
pseudo_clone = super().clone(group)
pseudo_clone._reset()
Expand Down

0 comments on commit a747abc

Please sign in to comment.