From 8c626c0e6a069e5222b31d6f7913a56effb59793 Mon Sep 17 00:00:00 2001 From: vicrodh Date: Sun, 8 Mar 2026 13:10:53 -0600 Subject: [PATCH] fix: poll output device name so it updates during playback The device name was only read on mount and on hover, so it stayed as "No device" until the user hovered the badges area. Now the 1-second poll also reads get_audio_output_status (cheap in-memory read) alongside hardware status, keeping the device name current. --- src/lib/components/AudioOutputBadges.svelte | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/lib/components/AudioOutputBadges.svelte b/src/lib/components/AudioOutputBadges.svelte index 142a11127..8be8c18d2 100644 --- a/src/lib/components/AudioOutputBadges.svelte +++ b/src/lib/components/AudioOutputBadges.svelte @@ -182,15 +182,19 @@ castProtocol = getConnectedProtocol(); }); - // Lightweight polling: ONLY update hardware status (no device enumeration) - // This reads /proc/asound which is very cheap, no CPAL/ALSA enumeration + // Lightweight polling: update hardware status + output device name const pollInterval = setInterval(async () => { // Only poll if using bit-perfect modes AND not casting if (!castConnected && (settings?.dac_passthrough || settings?.backend_type === 'Alsa')) { try { - hardwareStatus = await invoke('v2_get_hardware_audio_status').catch(() => null); - } catch (err) { - // Silently fail - don't spam console + const [hwStatus, status] = await Promise.all([ + invoke('v2_get_hardware_audio_status').catch(() => null), + invoke('get_audio_output_status').catch(() => null), + ]); + hardwareStatus = hwStatus; + if (status) outputStatus = status; + } catch { + // Silently fail } } }, 1000);