Added min/max events in audio service to notify subscribers when audio limit is reached

This commit is contained in:
nZo-sp
2026-03-17 17:54:28 +01:00
parent 23a5b1de55
commit 71568bd2a3
3 changed files with 35 additions and 0 deletions
+5
View File
@@ -29,6 +29,9 @@ Singleton {
property real wpctlOutputVolume: 0
property bool wpctlOutputMuted: true
signal volumeAtMaximum()
signal volumeAtMinimum()
function clampOutputVolume(vol: real): real {
if (vol === undefined || isNaN(vol)) {
return 0;
@@ -556,6 +559,7 @@ Singleton {
return;
}
if (volume >= root.maxVolume) {
volumeAtMaximum();
return;
}
setVolume(Math.min(root.maxVolume, volume + stepVolume));
@@ -566,6 +570,7 @@ Singleton {
return;
}
if (volume <= 0) {
volumeAtMinimum();
return;
}
setVolume(Math.max(0, volume - stepVolume));