clock: allow to specify a custom color and/or to use i3bar default color.

This commit is contained in:
Baptiste Grenier 2014-03-27 18:49:18 +01:00
parent 9356b5476a
commit 5c825436f2
2 changed files with 5 additions and 1 deletions

View File

@ -351,6 +351,7 @@ This class shows a clock
Settings:
:format: stftime format string, `None` means to use the default, locale-dependent format (default: ``None``)
:color: RGB hexadecimal code color specifier, set to `i3Bar` to use i3 bar default (default: ``#ffffff``)
:interval: (default: ``1``)

View File

@ -16,8 +16,10 @@ class Clock(IntervalModule):
settings = (
("format", "stftime format string, `None` means to use the default, locale-dependent format"),
("color", "RGB hexadecimal code color specifier, default to #ffffff, set to `i3Bar` to use i3 bar default"),
)
format = None
color = "#ffffff"
interval = 1
def init(self):
@ -37,5 +39,6 @@ class Clock(IntervalModule):
self.output = {
"full_text": datetime.datetime.now().strftime(self.format),
"urgent": False,
"color": "#ffffff"
}
if self.color != "i3Bar":
self.output["color"] = self.color