The icon changes depending on the slider value and clicking it
will switch the volume between 0 and 100
Details
- Reviewers
nicolasfella - Group Reviewers
KDE Connect - Commits
- R224:05a34747f316: Add mute button with dynamic icon to MPRIS volume control
Diff Detail
- Repository
- R224 KDE Connect
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
When I have my volume at e.g. 70%, mute and unmute again it will be 100%. I would rather expect it to be 70% again
Yeah, I thought about that but in the end I decides not to as mpris has no real way to mute (unlike plasma-pa, which when you click mute just keeps volume same but mutes output). Should I just save the last set volume somewhere and dim slider instead of changing position
Should I just save the last set volume somewhere and dim slider instead of changing position
Sounds good
| app/qml/mpris.qml | ||
|---|---|---|
| 147 | This is gonna be more readable in two lines. | |
| app/qml/mpris.qml | ||
|---|---|---|
| 141 | I think you could just set these as bindings rather than programmatically doing it onClicked | |
| app/qml/mpris.qml | ||
|---|---|---|
| 141 | How would I do that? | |
| app/qml/mpris.qml | ||
|---|---|---|
| 37 | You could also add a if (volume == 0) { return "audio-volume-muted" } and save the muted check below :) | |
| 141 | Button {
...
icon.name: muted ? "audio-volume-muted" : soundState(root.pluginInterface.volume)
...
}as well as Slider {
...
enabled: !muted
...
}and then just keep onClicked: {
muted = !muted
root.pluginInterface.volume = muted ? 0 : volumeUnmuted
} | |
Works good except for one thing: When I change the volume in the player itself the slider isn't updated. This worked before this patch.
| app/qml/mpris.qml | ||
|---|---|---|
| 155 | If you want the property to update instead of just setting the value, use Qt.binding(). It could also make sense to use visualPosition. | |
| app/qml/mpris.qml | ||
|---|---|---|
| 155 | Tried that, doesn't work | |
| app/qml/mpris.qml | ||
|---|---|---|
| 155 | Both? | |
| app/qml/mpris.qml | ||
|---|---|---|
| 55 | How about naming it toggleMute()? | |