Skip to content

Commit

Permalink
Use deepcopy to clone widgets
Browse files Browse the repository at this point in the history
Widgets' `clone` method used `copy.copy`. This causes an issue where
widgets defined list and dicts during `__init__` as these are not copied
and, instead, the same object is shared between widget instances. Using
`copy.deepcopy` should mean these objects are also copied.

Fixes #4668
  • Loading branch information
elParaguayo authored and tych0 committed Jan 29, 2024
1 parent a470afa commit 73fdce2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libqtile/widget/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ def create_mirror(self):
return Mirror(self, background=self.background)

def clone(self):
return copy.copy(self)
return copy.deepcopy(self)

def mouse_enter(self, x, y):
pass
Expand Down

0 comments on commit 73fdce2

Please sign in to comment.