[modules/dunst] Update to make working again

This commit is contained in:
Tobias Witek 2020-03-07 13:54:45 +01:00
parent 4bc5f73ccc
commit 7cdcde0080

View file

@ -2,24 +2,20 @@
'''Toggle dunst notifications.''' '''Toggle dunst notifications.'''
import bumblebee.input import core.module
import bumblebee.output import core.widget
import bumblebee.engine import core.input
import util.cli
class Module(bumblebee.engine.Module): class Module(core.module.Module):
def __init__(self, engine, config): def __init__(self, config=None):
super(Module, self).__init__(engine, config, super().__init__(config, core.widget.Widget(''))
bumblebee.output.Widget(full_text='')
)
self._paused = False self._paused = False
# Make sure that dunst is currently not paused # Make sure that dunst is currently not paused
try: util.cli.execute('killall -SIGUSR2 dunst', ignore_errors=True)
bumblebee.util.execute('killall -SIGUSR2 dunst') core.input.register(self, button=core.input.LEFT_MOUSE,
except: cmd=self.toggle_status
pass
engine.input.register_callback(self, button=bumblebee.input.LEFT_MOUSE,
cmd=self.toggle_status
) )
def toggle_status(self, event): def toggle_status(self, event):
@ -27,9 +23,9 @@ class Module(bumblebee.engine.Module):
try: try:
if self._paused: if self._paused:
bumblebee.util.execute('killall -SIGUSR1 dunst') util.cli.execute('killall -SIGUSR1 dunst')
else: else:
bumblebee.util.execute('killall -SIGUSR2 dunst') util.cli.execute('killall -SIGUSR2 dunst')
except: except:
self._paused = not self._paused # toggling failed self._paused = not self._paused # toggling failed