From c70283165613308011d575e3a0a6da60bd2d14ba Mon Sep 17 00:00:00 2001 From: Myryk Date: Sat, 1 Jun 2024 20:53:52 +0200 Subject: [PATCH] fixed volume above 100% --- .../ags/modules/indicators/indicatorvalues.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/.config/ags/modules/indicators/indicatorvalues.js b/.config/ags/modules/indicators/indicatorvalues.js index 94b2d694..4fde189b 100644 --- a/.config/ags/modules/indicators/indicatorvalues.js +++ b/.config/ags/modules/indicators/indicatorvalues.js @@ -83,18 +83,22 @@ export default (monitor = 0) => { Utils.timeout(1000, updateAudioDevice); }), labelSetup: (self) => self.hook(Audio, (label) => { - label.label = `${Math.round(Audio.speaker?.volume * 100)}`; + const newDevice = (Audio.speaker?.name); + const updateValue = Math.round(Audio.speaker?.volume * 100); + if (!isNaN(updateValue)) { + if (newDevice === volumeIndicator.attribute.device && updateValue != label.label) { + Indicator.popup(1); + } + } + volumeIndicator.attribute.device = newDevice; + label.label = `${updateValue}`; }), progressSetup: (self) => self.hook(Audio, (progress) => { const updateValue = Audio.speaker?.volume; - const newDevice = (Audio.speaker?.name); if (!isNaN(updateValue)) { - if (newDevice === volumeIndicator.attribute.device && updateValue !== progress.value) { - Indicator.popup(1); - } - progress.value = updateValue; + if (updateValue > 1) progress.value = 1; + else progress.value = updateValue; } - volumeIndicator.attribute.device = newDevice; }), }); return MarginRevealer({