feat(snap): ability to specify slot properties #5313
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What's in there?
This is required to allow snap-packaged app declaring mpris slots.
How to test?
Compile source and schema, then
TEST_FILES=snapTest yarn test
.Note to reviewers
I'm currently developing a portable music player with electron named
melodie
.One very basic feature is the usage of MediaMetadata, which makes the operating system aware of which track is currently playing, and gives it a change to pause, and jump to next or previous.
On linux systems, this integrations is use Media Player Remote Interface Specification (mpris): the application sends DBus commands to interact with the OS.
This works perfectly fine with all the packager I've tested, except with snap.
When running the snap in devmode or with classic confinement, Linux can interact with the player controls.
But when using strict confinement, Linux is not aware of it.
The
snappy-debug
tool spot the issue pretty quickly:After two days of try-and-fail research and web crawling it appears that:
mpris
slot needs aname
attribute. When it's not provided, the name is the application name (melodie
in my case)chromium
I initially though I could hardcode the mpris name as long as someone specifies
mpris
in electron-builder's configuration, but then I changed to something generic: there are other slots that require parameters.