diff --git a/bin/mpdevil b/bin/mpdevil index 2d64641..1871e84 100755 --- a/bin/mpdevil +++ b/bin/mpdevil @@ -3316,6 +3316,7 @@ class MPDActionGroup(Gio.SimpleActionGroup): self.add_action(action) # connect + self._client.emitter.connect("state", self._on_state) self._client.emitter.connect("disconnected", self._on_disconnected) self._client.emitter.connect("reconnected", self._on_reconnected) @@ -3355,6 +3356,11 @@ class MPDActionGroup(Gio.SimpleActionGroup): def _on_consume(self, action, param): self._client.wrapped_call("toggle_option", "consume") + def _on_state(self, emitter, state): + state_dict={"play": True, "pause": True, "stop": False} + for action in ("next","prev","seek-forward","seek-backward"): + self.lookup_action(action).set_enabled(state_dict[state]) + def _on_disconnected(self, *args): for action in self._simple_actions_data: self.lookup_action(action).set_enabled(False)