Skip to content

Commit

Permalink
Make the Spacer widget accept a background color (#1365)
Browse files Browse the repository at this point in the history
Fixes #1300
  • Loading branch information
krive001 authored and ramnes committed Jul 2, 2019
1 parent 1ae7d6f commit 417ce07
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions libqtile/widget/spacer.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,11 @@ class Spacer(base._Widget):
DEPRECATED, same as ``length``.
"""
orientations = base.ORIENTATION_BOTH
defaults = [
("background", None, "Widget background color")
]

def __init__(self, length=bar.STRETCH, width=None):
def __init__(self, length=bar.STRETCH, width=None, **config):
"""
"""
# 'width' was replaced by 'length' since the widget can be installed in
Expand All @@ -54,10 +57,11 @@ def __init__(self, length=bar.STRETCH, width=None):
'deprecated. Please use length.')
length = width

base._Widget.__init__(self, length)
base._Widget.__init__(self, length, **config)
self.add_defaults(Spacer.defaults)

def draw(self):
self.drawer.clear(self.bar.background)
self.drawer.clear(self.background or self.bar.background)
if self.bar.horizontal:
self.drawer.draw(offsetx=self.offset, width=self.length)
else:
Expand Down

0 comments on commit 417ce07

Please sign in to comment.