From 94427ea20f176c624895992f2f364258d42a5588 Mon Sep 17 00:00:00 2001 From: Tobias Witek Date: Tue, 30 Apr 2019 17:07:12 +0200 Subject: [PATCH] [modules] dunst: try to handle errors gracefully Try to handle dunst pause/unpause errors "gracefully" (ignore them). fixes #381 --- bumblebee/modules/dunst.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/bumblebee/modules/dunst.py b/bumblebee/modules/dunst.py index e2dbaa0..e805ef5 100644 --- a/bumblebee/modules/dunst.py +++ b/bumblebee/modules/dunst.py @@ -14,7 +14,10 @@ class Module(bumblebee.engine.Module): ) self._paused = False # Make sure that dunst is currently not paused - bumblebee.util.execute("killall -SIGUSR2 dunst") + try: + bumblebee.util.execute("killall -SIGUSR2 dunst") + except: + pass engine.input.register_callback(self, button=bumblebee.input.LEFT_MOUSE, cmd=self.toggle_status ) @@ -22,10 +25,13 @@ class Module(bumblebee.engine.Module): def toggle_status(self, event): self._paused = not self._paused - if self._paused: - bumblebee.util.execute("killall -SIGUSR1 dunst") - else: - bumblebee.util.execute("killall -SIGUSR2 dunst") + try: + if self._paused: + bumblebee.util.execute("killall -SIGUSR1 dunst") + else: + bumblebee.util.execute("killall -SIGUSR2 dunst") + except: + self._paused = not self._paused # toggling failed def state(self, widget): if self._paused: