From 5a995a91812c676158f2f3b2a7b82be4dac080d8 Mon Sep 17 00:00:00 2001
From: Mora Unie Youer <mora_unie_youer@riseup.net>
Date: Sun, 2 Mar 2025 22:41:53 +0300
Subject: fix: clamp audio slider volume

---
 widget/bar/Bar.tsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'widget/bar/Bar.tsx')

diff --git a/widget/bar/Bar.tsx b/widget/bar/Bar.tsx
index 353eddf..aa96db1 100644
--- a/widget/bar/Bar.tsx
+++ b/widget/bar/Bar.tsx
@@ -68,7 +68,7 @@ function AudioVolume() {
     <image iconName={bind(speaker, "volumeIcon")} />
     <slider
       hexpand
-      onScroll={(_self, dx, dy) => speaker.volume += (dx + dy) * -0.05}
+      onScroll={(_self, dx, dy) => speaker.volume = Math.min(1, Math.max(0, speaker.volume + (dx + dy) * -0.05))}
       onChangeValue={self => { speaker.volume = self.value; }}
       value={bind(speaker, "volume")}
     />
-- 
cgit v1.2.3-70-g09d2

