From f29ddae47a17f35f4f4e5829ea4b81a4ebb9d4ec Mon Sep 17 00:00:00 2001 From: Tobias Witek Date: Mon, 31 Oct 2016 13:09:52 +0100 Subject: [PATCH] [modules/nic] Fix status display First, cache lookups were bugged... Second, the output needs to call data() first, everything else later. This is a bit nasty, and I'll consider re-visiting this, but right now, I don't see any other way, given that modules can now be iterated. --- bumblebee/modules/nic.py | 5 +++-- bumblebee/outputs/i3.py | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/bumblebee/modules/nic.py b/bumblebee/modules/nic.py index a943177..5d23483 100644 --- a/bumblebee/modules/nic.py +++ b/bumblebee/modules/nic.py @@ -44,12 +44,13 @@ class Module(bumblebee.module.Module): try: iw.get_interface_by_ifindex(idx) self._cache["wlan{}".format(intf)] = True - except exception as e: + except Exception as e: self._cache["wlan{}".format(intf)] = False - return self._cache + return self._cache["wlan{}".format(intf)] def state(self): t = "wireless" if self._iswlan(self._intf) else "wired" + return "{}-{}".format(t, self._state) def warning(self): diff --git a/bumblebee/outputs/i3.py b/bumblebee/outputs/i3.py index 4d03f8a..d2a37ee 100644 --- a/bumblebee/outputs/i3.py +++ b/bumblebee/outputs/i3.py @@ -16,8 +16,9 @@ class i3bar(bumblebee.output.Output): theme = self.theme() while True: + d = obj.data() data = { - u"full_text": "{}{}{}".format(theme.prefix(obj), obj.data(), theme.suffix(obj)), + u"full_text": "{}{}{}".format(theme.prefix(obj), d, theme.suffix(obj)), "color": theme.color(obj), "background": theme.background(obj), }