From 9d96efbe9a929a5de5b8bb0932bf7191f3d6dedb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Mon, 19 Jun 2023 12:20:18 -0700 Subject: [PATCH] InputPanel: slow down monitor level decay --- src/InputPanel.vala | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/InputPanel.vala b/src/InputPanel.vala index 1fe47006..13aec067 100644 --- a/src/InputPanel.vala +++ b/src/InputPanel.vala @@ -12,6 +12,7 @@ public class Sound.InputPanel : Gtk.Box { private Gtk.Scale volume_scale; private Gtk.Switch volume_switch; private InputDeviceMonitor device_monitor; + private uint monitor_timeout_id = 0; private unowned PulseAudioManager pam; construct { @@ -80,7 +81,16 @@ public class Sound.InputPanel : Gtk.Box { device_monitor = new InputDeviceMonitor (); device_monitor.update_fraction.connect ((fraction) => { - level_bar.value = fraction; + if (fraction >= level_bar.value) { + level_bar.value = fraction; + return; + } + + monitor_timeout_id = Timeout.add (1, () => { + level_bar.value = level_bar.value * 0.95; + monitor_timeout_id = 0; + return Source.REMOVE; + }); }); pam = PulseAudioManager.get_default ();