Merge branch 'development' into arandr

This commit is contained in:
Zero Rust 2020-05-18 06:58:07 -04:00
commit 2fcd277cf9
34 changed files with 713 additions and 270 deletions

View file

@ -33,13 +33,18 @@ class Module(core.module.Module):
return self.__packages == 0 and not self.__error
def update(self):
try:
result = util.cli.execute("checkupdates")
self.__packages = len(result.split("\n")) - 1
self.__error = False
except Exception as e:
logging.exception(e)
self.__error = False
code, result = util.cli.execute(
"checkupdates", ignore_errors=True, return_exitcode=True
)
if code == 0:
self.__packages = len(result.split("\n"))
elif code == 2:
self.__packages = 0
else:
self.__error = True
log.error("checkupdates exited with {}: {}".format(code, result))
def state(self, widget):
if self.__error:

View file

@ -115,7 +115,7 @@ class Module(core.module.Module):
for battery in glob.glob("/sys/class/power_supply/BAT*")
]
if len(self._batteries) == 0:
raise Exceptions("no batteries configured/found")
raise Exception("no batteries configured/found")
core.input.register(
self, button=core.input.LEFT_MOUSE, cmd="gnome-power-statistics"
)

View file

@ -22,15 +22,15 @@ import core.decorators
import util.cli
import util.format
from bumblebee_status.discover import utility
# list of repositories.
# the last one should always be other
repos = ["core", "extra", "community", "multilib", "testing", "other"]
def get_pacman_info(widget, path):
cmd = "{}/../../bin/pacman-updates".format(path)
if not os.path.exists(cmd):
cmd = "/usr/share/bumblebee-status/bin/pacman-update"
cmd = utility("pacman-updates")
result = util.cli.execute(cmd, ignore_errors=True)
count = len(repos) * [0]

View file

@ -24,6 +24,8 @@ import core.module
import core.input
import core.decorators
from bumblebee_status.discover import utility
import util.cli
import util.format
@ -36,8 +38,7 @@ except:
class Module(core.module.Module):
@core.decorators.every(seconds=5) # takes up to 5s to detect a new screen
def __init__(self, config, theme):
widgets = []
super().__init__(config, theme, widgets)
super().__init__(config, theme, [])
self._autoupdate = util.format.asbool(self.parameter("autoupdate", True))
self._needs_update = True
@ -85,10 +86,9 @@ class Module(core.module.Module):
def _toggle(self, event):
self._refresh(self, event)
path = os.path.dirname(os.path.abspath(__file__))
if util.format.asbool(self.parameter("overwrite_i3config", False)) == True:
toggle_cmd = "{}/../../bin/toggle-display.sh".format(path)
toggle_cmd = utility("toggle-display.sh")
else:
toggle_cmd = "xrandr"