lemonbar: Automatically register and remove units
This commit is contained in:
@@ -9,7 +9,12 @@ slr = config.sep_l_right
|
||||
sl = config.sep_left
|
||||
sll = config.sep_l_left
|
||||
|
||||
class IconTextUnit:
|
||||
class LemonUnit:
|
||||
def __lt__(self, other):
|
||||
return self.order < other.order
|
||||
|
||||
|
||||
class IconTextUnit(LemonUnit):
|
||||
def __init__(self, name, order, action = None, alt_scheme=None, external=None):
|
||||
self.name = name
|
||||
self.action = action
|
||||
@@ -52,10 +57,7 @@ class IconTextUnit:
|
||||
blocks.append(close)
|
||||
return ''.join(blocks)
|
||||
|
||||
def __lt__(self, other):
|
||||
return self.order < other.order
|
||||
|
||||
class ButtonsUnit:
|
||||
class ButtonsUnit(LemonUnit):
|
||||
def __init__(self, name, order, alt_scheme=None, external=None):
|
||||
self.name = name
|
||||
self.order = order
|
||||
@@ -86,10 +88,7 @@ class ButtonsUnit:
|
||||
|
||||
return ''.join(blocks)
|
||||
|
||||
def __lt__(self, other):
|
||||
return self.order < other.order
|
||||
|
||||
class CustomUnit:
|
||||
class CustomUnit(LemonUnit):
|
||||
def __init__(self, name, format_function, order, action = None, alt_scheme=None, external=None):
|
||||
self.name = name
|
||||
self.action = action
|
||||
@@ -100,9 +99,6 @@ class CustomUnit:
|
||||
self.items = [] # List of tuples (icon, text)
|
||||
self.modes = [common.bar_mode.normal]
|
||||
|
||||
def __lt__(self, other):
|
||||
return self.order < other.order
|
||||
|
||||
class LemonParser:
|
||||
# Handle parsing of units
|
||||
# Apply alternating colors
|
||||
|
||||
Reference in New Issue
Block a user