bumblebee-status/bumblebee/modules/time.py
Tobias Witek 00c92cb9e3 [modules/time] Add parameter for format string
Format string for strftime is now configurable. Also, changed the
separator for module name vs. arguments to "::" to make it possible to
have ":" as part of the strftime format string (which is useful in most
cases).

Eventually, I'll probably have to come up with a better way, i.e. a
fully-fledged parser, and move away from "special characters", but right
now, the effort seems too much for the gain.
2016-10-31 10:53:31 +01:00

12 lines
337 B
Python

import datetime
import bumblebee.module
class Module(bumblebee.module.Module):
def __init__(self, args):
self._fmt = args[0] if args else "%x %X"
super(Module, self).__init__(args)
def data(self):
return datetime.datetime.now().strftime(self._fmt)
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4