4ad41a8ee0
Add - again a very simplistic - method for themeing the output. Essentially, the plan is to have JSON-formatted configuration files in bumblebee/themes/ and have a separate class for querying the config whenever the output needs to know about semantic formatting/coloring. Note that the theme object is stored on a per-module basis. Right now, that doesn't have any effect (except looking particularly wasteful), but the idea is to be able to have different themes for different modules in the future.
24 lines
498 B
Python
24 lines
498 B
Python
import json
|
|
import bumblebee.output
|
|
|
|
class i3bar(bumblebee.output.Output):
|
|
def __init__(self):
|
|
self._data = []
|
|
|
|
def start(self):
|
|
return json.dumps({ "version": 1 }) + "["
|
|
|
|
def add(self, obj):
|
|
self._data.append({
|
|
"full_text": obj.data()
|
|
})
|
|
|
|
def get(self):
|
|
data = json.dumps(self._data)
|
|
self._data = []
|
|
return data + ","
|
|
|
|
def stop(self):
|
|
return "]"
|
|
|
|
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|