Skip to content

Commit

Permalink
GroupBox: improve readability of getter for list of groups
Browse files Browse the repository at this point in the history
  • Loading branch information
m-col committed Feb 26, 2023
1 parent 15ce5a1 commit bb0f99f
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions libqtile/widget/groupbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,20 +266,15 @@ def groups(self):
their label. Groups with an empty string as label are never contained.
Groups that are not named in visible_groups are not returned.
"""
groups = filter(lambda g: g.label, self.qtile.groups)

if self.hide_unused:
if self.visible_groups:
return [
g
for g in self.qtile.groups
if g.label and (g.windows or g.screen) and g.name in self.visible_groups
]
else:
return [g for g in self.qtile.groups if g.label and (g.windows or g.screen)]
else:
if self.visible_groups:
return [g for g in self.qtile.groups if g.label and g.name in self.visible_groups]
else:
return [g for g in self.qtile.groups if g.label]
groups = filter(lambda g: g.windows or g.screen, groups)

if self.visible_groups:
groups = filter(lambda g: g.name in self.visible_groups, groups)

return list(groups)

def get_clicked_group(self):
group = None
Expand Down

0 comments on commit bb0f99f

Please sign in to comment.