Merge pull request #369 from eknoes/dunst-module

Add simple dunst module
This commit is contained in:
tobi-wan-kenobi 2019-03-26 19:30:07 +01:00 committed by GitHub
commit 478dba1e68
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 48 additions and 1 deletions

View file

@ -0,0 +1,33 @@
#pylint: disable=C0111,R0903
"""Toggle dunst notifications."""
import bumblebee.input
import bumblebee.output
import bumblebee.engine
class Module(bumblebee.engine.Module):
def __init__(self, engine, config):
super(Module, self).__init__(engine, config,
bumblebee.output.Widget(full_text="")
)
self._paused = False
# Make sure that dunst is currently not paused
bumblebee.util.execute("killall -SIGUSR2 dunst")
engine.input.register_callback(self, button=bumblebee.input.LEFT_MOUSE,
cmd=self.toggle_status
)
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")
def state(self, widget):
if self._paused:
return ["muted", "warning"]
return ["unmuted"]

View file

@ -125,4 +125,9 @@
"modified": { "prefix": "[m]" }, "modified": { "prefix": "[m]" },
"deleted": { "prefix": "[d]" } "deleted": { "prefix": "[d]" }
} }
"dunst": {
"muted": { "prefix": "dunst(muted)"},
"unmuted": { "prefix": "dunst" }
}
} }

View file

@ -188,5 +188,9 @@
"new": { "prefix": "" }, "new": { "prefix": "" },
"modified": { "prefix": "" }, "modified": { "prefix": "" },
"deleted": { "prefix": "" } "deleted": { "prefix": "" }
} },
"dunst": {
"muted": { "prefix": ""},
"unmuted": { "prefix": "" }
}
} }

View file

@ -159,4 +159,9 @@
"taskwarrior": { "taskwarrior": {
"prefix": "\uf454" "prefix": "\uf454"
} }
"dunst": {
"muted": { "prefix": "\uf39a"},
"unmuted": { "prefix": "\uf39b" }
}
} }