My collection of plugins for the Qtile window manager.
git clone https://mcol.xyz/code/qtools
Log | Files | Refs | README

commit b721cb4aa08179bfa7d8172b62ddb8bfce133041
parent faa93477c02bc79d0e86bac34861df4b5c4ab0bc
Author: mcol <mcol@posteo.net>
Date:   Sat, 11 Jan 2020 16:27:56 +0000

mpc: get message from new status rather than presume

Diffstat:
Mqtools/mpc/mpc.py | 12+++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/qtools/mpc/mpc.py b/qtools/mpc/mpc.py @@ -23,9 +23,16 @@ except ImportError: from qtools import Notifier +bodies = { + 'pause': 'Paused', + 'play': 'Playing', + 'stop': 'Stopped', +} + + def _client_func(func): @wraps(func) - def _inner(self, qtile): + def _inner(self, qtile=None): try: self.client.connect() except ConnectionError: @@ -60,10 +67,9 @@ class Client(Notifier): def toggle(self): if self.client.status()['state'] == 'play': self.client.pause() - return 'Paused' else: self.client.play() - return 'Playing' + return bodies.get(self.client.status()['state']) @_client_func def next(self):