mpd and title

This commit is contained in:
Dhananjay Tanpure 2022-03-07 08:50:30 +05:30
parent 8867f4f188
commit e5cdabcc0f
No known key found for this signature in database
GPG key ID: 4CCF71A10B0E84B6
2 changed files with 14 additions and 1 deletions

View file

@ -94,6 +94,12 @@ class Module(core.module.Module):
"cmd": "mpc toggle" + self._hostcmd,
}
widget.full_text(self.description)
elif widget_name == "mpd.toggle":
widget_map[widget] = {
"button": core.input.LEFT_MOUSE,
"cmd": "mpc toggle" + self._hostcmd,
}
widget.full_text(self.toggle)
elif widget_name == "mpd.next":
widget_map[widget] = {
"button": core.input.LEFT_MOUSE,
@ -127,6 +133,9 @@ class Module(core.module.Module):
def description(self, widget):
return string.Formatter().vformat(self._fmt, (), self._tags)
def toggle(self, widget):
return str(util.cli.execute("mpc status %currenttime%/%totaltime%", ignore_errors=True)).strip()
def update(self):
self._load_song()