Add some basic error handling in case the executables don't exist

This commit is contained in:
mw 2019-08-25 21:08:00 +02:00
parent 61fe85842a
commit c05fc3ae4d

View file

@ -30,11 +30,14 @@ class Module(bumblebee.engine.Module):
def _toggle(self, event):
self._active = not self._active
if self._active:
bumblebee.util.execute("xdg-screensaver reset")
bumblebee.util.execute("notify-send \"Consuming caffeine\"")
else:
bumblebee.util.execute("notify-send \"Out of coffee\"")
try:
if self._active:
bumblebee.util.execute("xdg-screensaver reset")
bumblebee.util.execute("notify-send \"Consuming caffeine\"")
else:
bumblebee.util.execute("notify-send \"Out of coffee\"")
except:
self._active = not self._active
def update(self, widgets):
if self._active: