From a8919c395fe69ec339bb34ad9000575b93e6994a Mon Sep 17 00:00:00 2001 From: Jas Singh Date: Tue, 17 Sep 2024 18:36:56 -0700 Subject: [PATCH] Fixed volume zero icon bug. (#270) --- modules/bar/volume/index.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/bar/volume/index.ts b/modules/bar/volume/index.ts index 94173ce..64e76b8 100644 --- a/modules/bar/volume/index.ts +++ b/modules/bar/volume/index.ts @@ -22,7 +22,15 @@ const Volume = (): BarBoxChild => { const icon: Binding = Utils.merge( [audio.speaker.bind('is_muted'), audio.speaker.bind('volume')], (isMuted, vol) => { - return isMuted ? 0 : [101, 66, 34, 1, 0].find((threshold) => threshold <= vol * 100) || 101; + if (isMuted) return 0; + + const foundVol = [101, 66, 34, 1, 0].find((threshold) => threshold <= vol * 100); + + if (foundVol !== undefined) { + return foundVol; + } + + return 101; }, );