Repository navigation
Done
Description
What happens
In the Sound widget's details popup, a click on an output or input device in the device list:
- closes the popup, while the card's other controls (volume, mute, an app's output menu) keep it open, and Control Center keeps its Sound module open;
- stalls the popup's closing animation, and anything else animating on the bar, for tens to hundreds of milliseconds.
Steps to reproduce
- Click the Sound widget, then the chevron next to Sound to list the outputs.
- Play something, such as music, and click another output.
Expected
The checkmark moves to the device and the popup stays open, without a stall.
Environment
- StableBar 0.19.0, and
mainat f1db91a. - macOS 27.2, MacBook Pro speakers, a USB headset and a DisplayPort monitor.
Evidence
An isolated dev copy (its own bundle ID and a scratch configuration) with the Sound popup open, sampled with sample at 1 ms while the default output switched to the headset and back:
| Main thread over 3 s | No switch | One switch |
|---|---|---|
In AudioMixer.refresh() |
0 samples | 1,108 and 1,237 samples (1.1–1.2 s) |
| Idle | 2,297 of 2,386 | 506 and 461 |
The copy had no mixer settings and no taps, so this doesn't depend on #897. A standalone harness with the same listeners saw 7 refreshes per switch, and main-thread gaps of 30 to 61 ms in the first 130 ms, while a popup closes. Setting the default output took 72 to 86 ms in 4 of 10 tries while sound played, and 1 to 5 ms otherwise.
Diagnosis
AudioMixer.start()(Sources/StableBar/DataSources/AudioMixer.swift) registers its CoreAudio listeners on.main, for the system and for every process'sIsRunningOutputandIsRunning, and each notification runs a fullrefresh(). That reads the PID, bundle ID and playing state of every process (about 33) and every device, each a round trip tocoreaudiod. A switch moves every app's sound, so it sends a burst of notifications whilecoreaudiodanswers slowly. The mixer starts with the first Sound popup and keeps listening.WidgetScripts.selectAudioDevicecallsAudioMonitor.setDefaultDeviceon the main actor, right after the popup starts closing. Volume and mute already go throughrunActionandBlockingWork.SoundDetailssends a device click throughcontext.selectAudioDevice, whichPopupViewcloses the popup for whendismissOnActionis on, as it is by default.
Related
- The Sound mixer loses the start of an app's sounds and plays the app at full volume while its tap is rebuilt #897 and fix: play an app's first sound at its mixer volume #899: the mixer's taps cut the start of each sound. Different code (
performandAppAudioTap), and its description notes that a busy main thread makes that worse. - Each workspace switch freezes the bar for about 200 ms, so the switch animation jumps #670: an earlier main-thread stall on the bar, from workspace switches.
Triaged by Claude Code (Claude Opus 5.5).
Activity
chore(release): 0.20.0 [skip ci]
stablebar-releases commentedon Nov 29, 2026
🎉 This issue has been resolved in version 0.20.0 🎉
The release is available on GitHub release
Your semantic-release bot 📦🚀