From bb1cc5de0e49a2dee3243c4818db1078c9322a94 Mon Sep 17 00:00:00 2001 From: Myryk Date: Fri, 31 May 2024 11:08:11 +0200 Subject: [PATCH] structured my code better --- .config/ags/modules/indicators/indicatorvalues.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.config/ags/modules/indicators/indicatorvalues.js b/.config/ags/modules/indicators/indicatorvalues.js index 625634609..94b2d694b 100644 --- a/.config/ags/modules/indicators/indicatorvalues.js +++ b/.config/ags/modules/indicators/indicatorvalues.js @@ -63,6 +63,7 @@ export default (monitor = 0) => { progress.value = updateValue; }, 'notify::screen-value'), }); + const volumeIndicator = OsdValue({ name: 'Volume', extraClassName: 'osd-volume', @@ -87,15 +88,13 @@ export default (monitor = 0) => { progressSetup: (self) => self.hook(Audio, (progress) => { const updateValue = Audio.speaker?.volume; const newDevice = (Audio.speaker?.name); - // print(newDevice, device); if (!isNaN(updateValue)) { - if ((volumeIndicator.attribute.device === undefined || newDevice === volumeIndicator.attribute.device) - && updateValue !== progress.value) { - Indicator.popup(1); - } - volumeIndicator.attribute.device = newDevice; + if (newDevice === volumeIndicator.attribute.device && updateValue !== progress.value) { + Indicator.popup(1); + } progress.value = updateValue; } + volumeIndicator.attribute.device = newDevice; }), }); return MarginRevealer({