From 1210f01eddf1979f9a8a4c9eed429d43e3fd7d53 Mon Sep 17 00:00:00 2001 From: Raphael Scholer Date: Sat, 3 Oct 2015 01:32:59 +0200 Subject: [PATCH] Add simple module to show internet connection --- i3pystatus/online.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 i3pystatus/online.py diff --git a/i3pystatus/online.py b/i3pystatus/online.py new file mode 100644 index 0000000..a363269 --- /dev/null +++ b/i3pystatus/online.py @@ -0,0 +1,32 @@ +from i3pystatus import IntervalModule +from i3pystatus.core.util import internet + + +class Online(IntervalModule): + + """Show internet connection status.""" + + settings = ( + ("color", "Text color when online"), + ('color_offline', 'Text color when offline'), + ('format_online', 'Status text when online'), + ('format_offline', 'Status text when offline'), + ) + + color = '#ffffff' + color_offline = '#ff0000' + format_online = 'online' + format_offline = 'offline' + interval = 10 + + def run(self): + if internet(): + self.output = { + "color": self.color, + "full_text": self.format_online, + } + else: + self.output = { + "color": self.color_offline, + "full_text": self.format_offline, + }