mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
Added min/max events in audio service to notify subscribers when audio limit is reached
This commit is contained in:
@@ -73,6 +73,28 @@ Item {
|
||||
externalHideTimer.restart();
|
||||
}
|
||||
}
|
||||
|
||||
function onVolumeAtMaximum() {
|
||||
if (!firstVolumeReceived) {
|
||||
firstVolumeReceived = true;
|
||||
} else {
|
||||
// Hide any tooltip while the pill is visible / being updated
|
||||
TooltipService.hide();
|
||||
pill.show();
|
||||
externalHideTimer.restart();
|
||||
}
|
||||
}
|
||||
|
||||
function onVolumeAtMinimum() {
|
||||
if (!firstVolumeReceived) {
|
||||
firstVolumeReceived = true;
|
||||
} else {
|
||||
// Hide any tooltip while the pill is visible / being updated
|
||||
TooltipService.hide();
|
||||
pill.show();
|
||||
externalHideTimer.restart();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
|
||||
@@ -251,6 +251,14 @@ Variants {
|
||||
showOSD(OSD.Type.Volume);
|
||||
}
|
||||
|
||||
function onVolumeAtMaximum() {
|
||||
showOSD(OSD.Type.Volume);
|
||||
}
|
||||
|
||||
function onVolumeAtMinimum() {
|
||||
showOSD(OSD.Type.Volume);
|
||||
}
|
||||
|
||||
function onMutedChanged() {
|
||||
if (AudioService.consumeOutputOSDSuppression())
|
||||
return;
|
||||
|
||||
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user