From c5877b3897cb5e7d8dd7735083bd0841daf09fc6 Mon Sep 17 00:00:00 2001 From: matt1432 Date: Mon, 11 Sep 2023 19:35:25 -0400 Subject: [PATCH] fix(ags): stop sound icon from flashing when muted and changing volume --- config/ags/js/bar/audio.js | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/config/ags/js/bar/audio.js b/config/ags/js/bar/audio.js index d059683..2d62b76 100644 --- a/config/ags/js/bar/audio.js +++ b/config/ags/js/bar/audio.js @@ -14,16 +14,17 @@ const SpeakerIndicator = params => Icon({ ...params, icon: '', connections: [[Audio, icon => { - if (!Audio.speaker) - return; - - if (Audio.speaker.isMuted) - return icon.icon = items[0]; - - const vol = Audio.speaker.volume * 100; - for (const threshold of [100, 66, 33, 0, -1]) { - if (vol > threshold + 1) - return icon.icon = items[threshold + 1]; + if (Audio.speaker) { + if (Audio.speaker.isMuted) { + icon.icon = items[0]; + } + else { + const vol = Audio.speaker.volume * 100; + for (const threshold of [100, 66, 33, 0, -1]) { + if (vol > threshold + 1) + icon.icon = items[threshold + 1]; + } + } } }, 'speaker-changed']], });