Skip to content

feat: add per-app sound mixer with menu bar access#213

Open
lou1s19 wants to merge 1 commit into
jacklandrin:mainfrom
lou1s19:feat/sound-mixer
Open

feat: add per-app sound mixer with menu bar access#213
lou1s19 wants to merge 1 commit into
jacklandrin:mainfrom
lou1s19:feat/sound-mixer

Conversation

@lou1s19

@lou1s19 lou1s19 commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

What

Adds a sound mixer to OnlySwitch — a new App Sound settings section and
an optional menu bar item that opens a compact mixer modeled on the macOS
system Sound panel:

  • System volume slider
  • A per-app row for every app currently playing audio, with mute and a
    volume slider
  • The current output device

How it works

Two mechanisms, chosen automatically per app:

  1. Scriptable media apps (Music, Spotify, TV, iTunes) — read and written
    through AppleScript's standard sound volume (0–100).
  2. Any other app that outputs audio, including browsers like Chrome — via
    a Core Audio process tap (AudioHardwareCreateProcessTap, macOS 14.4+).
    macOS exposes no per-app output-level API, so the tap routes the app's audio
    through a private aggregate device and scales the samples itself (continuous
    gain, of which mute is the 0 case). It falls back to silencing on any
    non-Float32 stream format. Below macOS 14.4 only the scriptable apps appear.

Menu bar item

Opt-in via the App Sound settings toggle. It gets its own status item
(speaker.wave.2.fill), created before the hide-menu-bar "mark" item so that
collapsing the menu bar doesn't strip it. A hint in settings points to
System Settings › Control Center › Sound for anyone who wants it to stand in
for the system sound item.

Notes

  • Adds NSAudioCaptureUsageDescription — the process tap triggers the system
    audio-capture permission prompt on first use.
  • All new UI strings are added to Localizable.xcstrings in the full set of
    languages the project already ships.
  • Manually tested on Apple Silicon: the App Sound settings page, the menu bar
    toggle (add/remove), and the mixer popover. Feedback welcome on the
    process-tap path across a wider range of apps.

Screenshots

SCR-20260720-nocb
SCR-20260720-nojr

Add an "App Sound" settings section and an optional menu bar item that
opens a mixer styled after the system Sound panel: a system-volume
slider, a per-app row for every app currently playing audio, and the
current output device.

Two control paths cover different apps:
- Scriptable media apps (Music, Spotify, TV, iTunes) via AppleScript's
  `sound volume`.
- Any other app that outputs audio, including browsers, via a Core Audio
  process tap (macOS 14.4+) that scales the app's samples through a
  private aggregate device.

The menu bar item is opt-in and is created before the hide-menubar mark
item so it survives collapsing. Adds NSAudioCaptureUsageDescription for
the process-tap capture prompt.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant