-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Linux: Volume control #36
Comments
I'll work on it this week, thanks for pointing it out! |
Got something working. Check out the |
Also, something I fear with this update is that |
Idk either, I have no clue about the MPRIS specification. Also thanks! How can I test it with my program though? What can I change in the Cargo.toml files? |
The
Change your current line importing souvlaki to this: souvlaki = { git = "https://github.com/Sinono3/souvlaki", branch = "volume" } Then of course, implement the handling of the "SetVolume" event and also use the |
I would like to use volume control on MacOS too, does it already support it? https://stackoverflow.com/questions/11045814/emulate-media-key-press-on-mac |
It was only implemented on Linux. I can't implement it for MacOS since I don't have access to an Apple device 😢 |
Any updates, will it be released to main branch? |
I can't really test |
To give an update on this. I've been working on a refactor of the library which will bring in a bunch of fixes as well as add missing features such as this one. Volume is already working on my machine. |
Great! Thanks @Sinono3. Look forward to the new changes |
@apprehensions in case you want to test volume control with diff --git a/Cargo.lock b/Cargo.lock
index 54b9060..23a78d9 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -4106,9 +4106,8 @@ dependencies = [
[[package]]
name = "souvlaki"
-version = "0.6.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "951a075f224d8c87bb62a08c9c27a373fd6d453407e89cae00a25e2eac74ef51"
+version = "0.6.0"
+source = "git+https://github.com/Sinono3/souvlaki?branch=volume#0f8e6740b262958408ddc901220c4613b3f517ca"
dependencies = [
"block",
"cocoa",
diff --git a/spotify_player/Cargo.toml b/spotify_player/Cargo.toml
index f5994cc..988d430 100644
--- a/spotify_player/Cargo.toml
+++ b/spotify_player/Cargo.toml
@@ -35,7 +35,7 @@ tracing = "0.1.40"
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
lyric_finder = { version = "0.1.4", path = "../lyric_finder" , optional = true }
backtrace = "0.3.69"
-souvlaki = { version = "0.6.1", optional = true }
+souvlaki = { git = "https://github.com/Sinono3/souvlaki", branch = "volume", optional = true }
winit = { version = "0.29.4", optional = true }
viuer = { version = "0.7.1", optional = true }
image = { version = "0.24.7", optional = true }
diff --git a/spotify_player/src/media_control.rs b/spotify_player/src/media_control.rs
index 133e966..6bc5367 100644
--- a/spotify_player/src/media_control.rs
+++ b/spotify_player/src/media_control.rs
@@ -109,6 +109,11 @@ pub fn start_event_watcher(
.send(ClientRequest::Player(PlayerRequest::PreviousTrack))
.unwrap_or_default();
}
+ MediaControlEvent::SetVolume(volume) => client_pub
+ .send(ClientRequest::Player(PlayerRequest::Volume(
+ (volume * 100.0) as u8,
+ )))
+ .unwrap_or_default(),
_ => {}
}
})?; |
@Sinono3 |
Just pushed version 0.7 which should have volume control for Linux.
No, sorry. I plan on buying a Mac soon. There won't be support until then or until someone else implements it. I'll create other issues for the other OSes. |
I am happy to report that testing with the following command: dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify_player /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Set string:'org.mpris.MediaPlayer2.Player' string:'Volume' variant:double:0.4 Reveals that, yes the test_volume branch of spotify_player works as intended with souvlaki. Souvlaki 0.7.0 also works. |
@LucasFA Thanks for testing! 🙂 |
Currently as of latest commit f169034 at the time of this issue:
souvlaki/src/platform/mpris/zbus.rs
Lines 308 to 311 in f169034
It seems that volume requests are simply not handled and is simply a stub function(?)
When is this feature going to be implemented and picked up by MPRIS requests?
Thanks.
The text was updated successfully, but these errors were encountered: