[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.
This commit is contained in:
parent
0f6b418385
commit
f29ddae47a
2 changed files with 5 additions and 3 deletions
|
@ -44,12 +44,13 @@ class Module(bumblebee.module.Module):
|
||||||
try:
|
try:
|
||||||
iw.get_interface_by_ifindex(idx)
|
iw.get_interface_by_ifindex(idx)
|
||||||
self._cache["wlan{}".format(intf)] = True
|
self._cache["wlan{}".format(intf)] = True
|
||||||
except exception as e:
|
except Exception as e:
|
||||||
self._cache["wlan{}".format(intf)] = False
|
self._cache["wlan{}".format(intf)] = False
|
||||||
return self._cache
|
return self._cache["wlan{}".format(intf)]
|
||||||
|
|
||||||
def state(self):
|
def state(self):
|
||||||
t = "wireless" if self._iswlan(self._intf) else "wired"
|
t = "wireless" if self._iswlan(self._intf) else "wired"
|
||||||
|
|
||||||
return "{}-{}".format(t, self._state)
|
return "{}-{}".format(t, self._state)
|
||||||
|
|
||||||
def warning(self):
|
def warning(self):
|
||||||
|
|
|
@ -16,8 +16,9 @@ class i3bar(bumblebee.output.Output):
|
||||||
theme = self.theme()
|
theme = self.theme()
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
d = obj.data()
|
||||||
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),
|
"color": theme.color(obj),
|
||||||
"background": theme.background(obj),
|
"background": theme.background(obj),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue