This plugin allows controlling the system value from a remote device.
Details
- Reviewers
mtijink albertvaka - Group Reviewers
KDE Connect - Maniphest Tasks
- T4659: Add general system volume control to MPRIS controls using pulseaudio
- Commits
- R224:02e52b787b8a: Add systemvolume plugin
Apply Android patch, open up MPRIS Activity and play with the slider
Diff Detail
- Repository
- R224 KDE Connect
- Branch
- arcpatch-D7992
- Lint
No Linters Available - Unit
No Unit Test Coverage
You can use pactl list sinks or pacmd info to get the current volume, but then you'll have to parse that information, unfortunately.
plugins/systemvolume/systemvolumeplugin.cpp | ||
---|---|---|
61 | You can find Qt pulseaudio code in the plasma-pa repo. |
You can use pactl list sinks or pacmd info to get the current volume, but then you'll have to parse that information, unfortunately.
I got a working solution using pactl and some pretty ugly bash-magic. It works with a single audio sink but needs some adjustment to support multiple sinks.
plugins/systemvolume/systemvolumeplugin.cpp | ||
---|---|---|
61 | Thanks, will take a look at it |
Use libpulse. I copied the code from plasma-pa without modifying it. Most of it is unused, but *could* be
useful someday for more advanced features (e.g. switching profiles). I'm not sure how to deal with that. We
could strip down to the needed code, but then we could not apply improvements from plasma-pa easily.
As discussed by email, we need to find a way to not duplicate all this code. Apart from that, I really like how it works :)
One small bug I found: if the audio sink changes (eg: from pavucontrol I chose a different output), I have to close the MPRIS activity on Android and open it again for it to refresh. Very minor though, we can merge it unfixed.
Don't know if this will help but I use two combined plasmoids to achieve this nice effect:
The firs one controls the default sink while the second one change it's volume.
Looks good. Is depending on PulseAudioQt okay already?
plugins/systemvolume/systemvolumeplugin.cpp | ||
---|---|---|
63 | Do we need to check the packet type here? We already know it's destined for this plugin. | |
70 | Needs a check to see if the requested sink still exists. | |
73 | Same here. | |
94 | What happens if we already had that sink? Do we connect to this signal twice? | |
132 | This code doesn't connect to the signals, so that's not correct, right? |
plugins/CMakeLists.txt | ||
---|---|---|
23 | The subdirectory is added twice. |
We don't need to wait the release to merge this patch, since we have the if(KF5PulseAudioQt_FOUND). Let's merge it now and in parallel @apol can help with getting pulseaudio-qt released soon.