bumblebee-status/bumblebee/modules/time.py
Tobias Witek b3e17d4899 [modules/date] Combine to datetime module with date and time aliases
Move module "date" to "datetime" (display both date and time), and
create new aliases "time" and "date" (which only show date and time,
respectively).
2016-10-31 14:39:52 +01:00

23 lines
566 B
Python

from __future__ import absolute_import
import datetime
import bumblebee.module
class Module(bumblebee.module.Module):
def __init__(self, args):
super(Module, self).__init__(args)
module = self.__module__.split(".")[-1]
default = "%x %X"
if module == "date":
default = "%x"
if module == "time":
default = "%X"
self._fmt = args[0] if args else default
def data(self):
return datetime.datetime.now().strftime(self._fmt)
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4