Skip to content
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

Added System Media Player Integration #166

Merged
merged 7 commits into from
Dec 11, 2021
Merged

Added System Media Player Integration #166

merged 7 commits into from
Dec 11, 2021

Conversation

wapacro
Copy link
Contributor

@wapacro wapacro commented Dec 10, 2021

Hey @pascalopitz

Thank you for this awesome Sonos Controller for Linux! I only recently started using it myself on a daily basis and one thing that has long bothered me about the official Windows Sonos controller was the lack of integration into the operating system, so without further ado I wanted to take the chance and make this possible at least on Linux 😉

Therefore, this pull request adds an MPRIS integration for the currently played song in the currently selected device/group. This allows among other things:

  • Showing the currently played song/artist on operating system level (e.g. notification center, taskbar, ...)
  • Basic control via the integration just mentioned (play, pause, next, previous)
  • Allows the use of media keys on the keyboard without having to have the Sonos controller window focused (as requested here: Implement Keyboard/Applet control (MPRIS) #74)

Here's how that could look like:
image

Never worked with Electron and only indirectly with React, so very interested in your feedback and please let me know if you want me to adjust anything.

@pascalopitz
Copy link
Owner

pascalopitz commented Dec 10, 2021

@wapacro This is excellent work!

Testing it quickly, I can see that if there's no Song in the queue, I get "Unknown Artist", "Unknown song".

One more thought here: Streams might disable seek, next and so on. I can see from the mpris-service documentation, that there are properties for that available also. They should probably get mapped depending on the current track type.

@wapacro
Copy link
Contributor Author

wapacro commented Dec 10, 2021

Many thanks for the inputs 🙂

Testing it quickly, I can see that if there's no Song in the queue, I get "Unknown Artist", "Unknown song".

Indeed, missed that. Unfortunately, I can't find a way right now to close an MPRIS channel/player once it has been instantiated, but I have nevertheless delayed the initialization so that the player is not created until there is effectively something to display. Switching back and forth between devices with and without queue therefore still leads to the "Unknown song" problem; however, it no longer occurs at app startup if the automatically/initially selected device has no queue. See commit 0fb35be

One more thought here: Streams might disable seek, next and so on. I can see from the mpris-service documentation, that there are properties for that available also. They should probably get mapped depending on the current track type.

Great idea! The anyway (for now) not supported features like seeking are now statically disabled (cfbce46); "play", "next" and "previous" are dynamically de-/activated (15d5f14).

@pascalopitz pascalopitz merged commit 0fb35be into pascalopitz:master Dec 11, 2021
@pascalopitz
Copy link
Owner

New release published, v0.2.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants