Merge branch 'master' of git://github.com/tobi-wan-kenobi/bumblebee-status

This commit is contained in:
Max Pivo 2020-02-27 12:20:02 -08:00
commit 4fdba0be19
13 changed files with 167 additions and 42 deletions

View file

@ -240,7 +240,7 @@ class Module(bumblebee.engine.Module):
def state(self, widget):
state = []
capacity = widget.get("capacity")
capacity = widget.get("capacity", -1)
if capacity < 0:
return ["critical", "unknown"]

View file

@ -91,17 +91,16 @@ class Module(bumblebee.engine.Module):
def cpuload(self, _):
return "{}%".format(self._cpuload)
@staticmethod
def add_color(bar):
def add_color(self, bar):
"""add color as pango markup to a bar"""
if bar in ["", ""]:
color = "green"
color = self.theme().color("green", "green")
elif bar in ["", ""]:
color = "yellow"
color = self.theme().color("yellow", "yellow")
elif bar in ["", ""]:
color = "orange"
color = self.theme().color("orange", "orange")
elif bar in ["", ""]:
color = "red"
color = self.theme().color("red", "red")
colored_bar = "<span foreground='{}'>{}</span>".format(color, bar)
return colored_bar

View file

@ -142,12 +142,12 @@ class Module(bumblebee.engine.Module):
vol, bumblebee.output.hbar(float(self._left)))
return vol
else:
vol = "{}%/{}%".format(self._left, self._right)
if self._showbars:
vol = "{} {}{}".format(
vol,
bumblebee.output.hbar(float(self._left)),
bumblebee.output.hbar(float(self._right)))
vol = "{}%/{}%".format(self._left, self._right)
return vol
def update(self, widgets):

View file

@ -18,6 +18,7 @@ import logging
import bumblebee.input
import bumblebee.output
import bumblebee.engine
import bumblebee.popup_v2
import functools
class Module(bumblebee.engine.Module):
@ -76,7 +77,7 @@ class Module(bumblebee.engine.Module):
try:
bumblebee.util.execute("nmcli c up \"{vpn}\""
.format(vpn=self._connected_vpn_profile))
.format(vpn=self._selected_vpn_profile))
self._connected_vpn_profile = name
except Exception as e:
logging.exception("Couldn't establish VPN connection")