From c4abbb6e38597c36cd8d6cc234832db4865e2d45 Mon Sep 17 00:00:00 2001 From: NNEU-1 <50910372+NNEU-1@users.noreply.github.com> Date: Sat, 12 Jun 2021 11:56:05 +0200 Subject: [PATCH] Update dbus_mpris.rs add 'VolumeUp' and 'VolumeDown' methods to dbus/MPRIS. Increment = 6% --- src/dbus_mpris.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/dbus_mpris.rs b/src/dbus_mpris.rs index b6ef0197..e0120ad8 100644 --- a/src/dbus_mpris.rs +++ b/src/dbus_mpris.rs @@ -258,6 +258,23 @@ fn create_dbus_server( // The following methods and properties are part of the MediaPlayer2.Player interface. // https://specifications.freedesktop.org/mpris-spec/latest/Player_Interface.html + + let method_volume_up = { + let local_spirc = spirc.clone(); + f.amethod("VolumeUp", (), move |m| { + local_spirc.volume_up(); + Ok(vec![m.msg.method_return()]) + }) + }; + + let method_volume_down = { + let local_spirc = spirc.clone(); + f.amethod("VolumeDown", (), move |m| { + local_spirc.volume_down(); + Ok(vec![m.msg.method_return()]) + }) + }; + let method_next = { let local_spirc = spirc.clone(); f.amethod("Next", (), move |m| { @@ -584,6 +601,8 @@ fn create_dbus_server( let media_player2_player_interface = f .interface("org.mpris.MediaPlayer2.Player", ()) + .add_m(method_volume_up) + .add_m(method_volume_down) .add_m(method_next) .add_m(method_previous) .add_m(method_pause)