From 8e20486e2e4dadeedeefd1e6b5b29ab9a2a58e9a Mon Sep 17 00:00:00 2001 From: Myryk Date: Fri, 31 May 2024 10:59:13 +0200 Subject: [PATCH] fixed unwanted popup when changing device --- .config/ags/modules/indicators/indicatorvalues.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.config/ags/modules/indicators/indicatorvalues.js b/.config/ags/modules/indicators/indicatorvalues.js index 7012c82a..62563460 100644 --- a/.config/ags/modules/indicators/indicatorvalues.js +++ b/.config/ags/modules/indicators/indicatorvalues.js @@ -63,12 +63,11 @@ export default (monitor = 0) => { progress.value = updateValue; }, 'notify::screen-value'), }); - const volumeIndicator = OsdValue({ name: 'Volume', extraClassName: 'osd-volume', extraProgressClassName: 'osd-volume-progress', - attribute: { headphones: undefined }, + attribute: { headphones: undefined , device: undefined}, nameSetup: (self) => Utils.timeout(1, () => { const updateAudioDevice = (self) => { const usingHeadphones = (Audio.speaker?.stream?.port)?.toLowerCase().includes('headphone'); @@ -87,8 +86,14 @@ 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 (updateValue !== progress.value) Indicator.popup(1); + if ((volumeIndicator.attribute.device === undefined || newDevice === volumeIndicator.attribute.device) + && updateValue !== progress.value) { + Indicator.popup(1); + } + volumeIndicator.attribute.device = newDevice; progress.value = updateValue; } }),