parent
8863ce1c5b
commit
e80ae8b91e
3 changed files with 12 additions and 3 deletions
|
@ -39,7 +39,7 @@ def main():
|
|||
)
|
||||
|
||||
theme = bumblebee.theme.Theme(config.theme(), config.iconset())
|
||||
output = bumblebee.output.I3BarOutput(theme=theme)
|
||||
output = bumblebee.output.I3BarOutput(theme=theme, config=config)
|
||||
inp = bumblebee.input.I3BarInput()
|
||||
engine = None
|
||||
|
||||
|
|
|
@ -57,6 +57,8 @@ def create_parser():
|
|||
help=LIST_HELP)
|
||||
parser.add_argument("-d", "--debug", action="store_true",
|
||||
help=DEBUG_HELP)
|
||||
parser.add_argument("-r", "--right-to-left", action="store_true",
|
||||
help="Draw widgets from right to left, rather than left to right (which is the default)")
|
||||
parser.add_argument("-f", "--logfile", default="~/bumblebee-status-debug.log",
|
||||
help="Location of the debug log file")
|
||||
parser.add_argument("-i", "--iconset", default="auto",
|
||||
|
@ -100,6 +102,9 @@ class Config(bumblebee.store.Store):
|
|||
def debug(self):
|
||||
return self._args.debug
|
||||
|
||||
def reverse(self):
|
||||
return self._args.right_to_left
|
||||
|
||||
def logfile(self):
|
||||
return os.path.expanduser(self._args.logfile)
|
||||
|
||||
|
|
|
@ -83,10 +83,11 @@ class Widget(bumblebee.store.Store):
|
|||
|
||||
class I3BarOutput(object):
|
||||
"""Manage output according to the i3bar protocol"""
|
||||
def __init__(self, theme):
|
||||
def __init__(self, theme, config=None):
|
||||
self._theme = theme
|
||||
self._widgets = []
|
||||
self._started = False
|
||||
self._config = config
|
||||
|
||||
def started(self):
|
||||
return self._started
|
||||
|
@ -143,7 +144,10 @@ class I3BarOutput(object):
|
|||
|
||||
def flush(self):
|
||||
"""Flushes output"""
|
||||
sys.stdout.write(json.dumps(self._widgets))
|
||||
widgets = self._widgets
|
||||
if self._config and self._config.reverse():
|
||||
widgets = list(reversed(widgets))
|
||||
sys.stdout.write(json.dumps(widgets))
|
||||
|
||||
def end(self):
|
||||
"""Finalizes output"""
|
||||
|
|
Loading…
Reference in a new issue