mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
play volume feedback when changing volume externally
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user