From 13c684860df3c242267a63f1df057aa95d4b62b7 Mon Sep 17 00:00:00 2001 From: enkore Date: Sat, 23 Feb 2013 20:43:38 +0100 Subject: [PATCH] Actualize clock once per second --- README.md | 2 +- i3pystatus/clock.py | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d4bda2a..8859b47 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ battery status This class shows a clock -* format +* format — stftime format string ### mail diff --git a/i3pystatus/clock.py b/i3pystatus/clock.py index 4e48bb8..e450ed2 100644 --- a/i3pystatus/clock.py +++ b/i3pystatus/clock.py @@ -10,8 +10,11 @@ class Clock(IntervalModule): This class shows a clock """ - settings = ("format",) + settings = ( + ("format", "stftime format string"), + ) format = None + interval = 1 def init(self): if self.format is None: @@ -38,9 +41,8 @@ class Clock(IntervalModule): self.format = "%a %-d %b %X" def run(self): - full_text = datetime.datetime.now().strftime(self.format) self.output = { - "full_text": full_text, + "full_text": datetime.datetime.now().strftime(self.format), "name": "pyclock", "urgent": False, "color": "#ffffff"