play volume feedback when changing volume externally

This commit is contained in:
shouya
2026-03-20 13:44:17 +09:00
parent 219a4742df
commit 222cf23636
+10
View File
@@ -14,6 +14,10 @@ Singleton {
property var lastVolumeFeedbackTime: 0
readonly property int minVolumeFeedbackInterval: 100
// Track the last sink that produced volume feedback so we can suppress the
// initial onVolumeChanged that fires on startup and device switches.
property PwNode _lastFeedbackSink: null
// Devices
readonly property PwNode sink: Pipewire.ready ? Pipewire.defaultAudioSink : null
readonly property PwNode source: validatedSource
@@ -502,6 +506,12 @@ Singleton {
return;
}
if (root.sink !== root._lastFeedbackSink) {
root._lastFeedbackSink = root.sink;
} else {
playVolumeFeedback(clampOutputVolume(vol));
}
// If volume exceeds max, clamp it (but only if we didn't just set it)
if (vol > root.maxVolume) {
root.isSettingOutputVolume = true;