Name Chrome streams after their browser tabs
A browser extension reports audible tabs to moonmix-tabs-host, which matches them to PipeWire streams by time and publishes the names for the mixer; streams of one tab share a row. Ambiguous streams keep the browser's name. Without the extension, a browser's only running stream shows its MPRIS title. The smoke test no longer claims real audio hardware. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b61d504234
commit
e16cc1b2ad
31 files changed
+1830
-15
No files matched your search
@@ -25,6 +25,8 @@ on top of libpipewire-0.3. It never runs `wpctl`, `pactl`, `pw-cli`,
|
||||
|
||||
- **Playback**: every application stream, with a volume slider, mute and the
|
||||
output device it plays to (choose another to move it).
|
||||
- **Browser tabs**: with the [browser extension](#browser-tabs), Chrome's
|
||||
streams are named after their tabs, one row per tab.
|
||||
- **Recording**: capture streams, same controls, input device selector.
|
||||
- **Output Devices** / **Input Devices**: sinks and sources with volume, mute
|
||||
and a *Default* toggle that shows and sets the default device.
|
||||
@@ -55,6 +57,9 @@ sliders, monitor sources in Input Devices, meters for recording streams.
|
||||
```
|
||||
cmd/moonmix GUI: builds tabs, reconciles widgets with view rows
|
||||
cmd/moonmix-probe headless CLI over the same stack (smoke tests, debugging)
|
||||
cmd/moonmix-tabs-host native-messaging host: names browser streams by tab
|
||||
extension/ the browser extension it talks to
|
||||
tabs/ tab name files and MPRIS: tabs_stub.c + tabs.mbt
|
||||
model/ pure MoonBit: volume curve, state reducer, view model
|
||||
wp/ WirePlumber binding: wp_stub.c + wp.mbt
|
||||
gtk/ minimal hand-written GTK4 binding: gtk_stub.c + gtk.mbt
|
||||
@@ -103,6 +108,45 @@ flowchart LR
|
||||
scroll handling (10% per detent, swallowing every scroll) with one that
|
||||
asks MoonBit synchronously whether the slider or the list gets the event.
|
||||
|
||||
## Browser tabs
|
||||
|
||||
Chrome opens separate audio streams for each tab (one for the media elements
|
||||
of the page and its frames, others for Web Audio), so each tab already has its
|
||||
own volume, mute, output and meter. But every stream is called "Google
|
||||
Chrome / Playback". To name them:
|
||||
|
||||
```sh
|
||||
just install-browser-tabs
|
||||
```
|
||||
|
||||
then open `chrome://extensions`, turn on *Developer mode*, choose *Load
|
||||
unpacked* and select `~/.local/share/moonmix/extension`. This works for
|
||||
Chrome, Chromium, Brave, Edge and Vivaldi installed natively (a Flatpak or
|
||||
Snap browser cannot start the host). `tools/install-browser-tabs.py
|
||||
--uninstall` removes it again.
|
||||
|
||||
- The **extension** tells **moonmix-tabs-host** (native messaging, started by
|
||||
the browser) which tabs are audible, with their titles. It sends no page
|
||||
addresses and nothing about silent or incognito tabs, and nothing leaves
|
||||
the machine. Its `tabs` permission does allow it to see titles and
|
||||
addresses of all tabs.
|
||||
- The browser does not say which stream is which tab's. The host sees streams
|
||||
start and tabs become audible, and **matches them by time**
|
||||
(`model/tabs.mbt`), or by elimination when only one tab can be meant. It
|
||||
runs as long as the browser, so the mixer need not be open. It publishes
|
||||
the matches in `$XDG_RUNTIME_DIR/moonmix/` (mode 0700).
|
||||
- **Ambiguous streams keep the browser's name**: tabs that start within the
|
||||
same moment, or several that were already playing when the host started.
|
||||
Pausing one and playing it again resolves it.
|
||||
- Streams of one tab share a row, which controls all of them.
|
||||
|
||||
Without the extension, a browser's only running stream shows the title the
|
||||
browser publishes over **MPRIS**. WirePlumber remembers volumes per
|
||||
application, so a new tab starts at the volume last set for any tab.
|
||||
|
||||
The container image only reads the published names: the host and extension
|
||||
are installed natively.
|
||||
|
||||
## Appearance
|
||||
|
||||
moonmix reads the desktop's **accent colour** and **colour scheme** from the
|
||||
@@ -223,7 +267,8 @@ set `MOONMIX_IMAGE` to run a different local tag.
|
||||
|
||||
The runner maps your user ID and mounts only the Wayland and PipeWire
|
||||
sockets (including `PIPEWIRE_RUNTIME_DIR` / `PIPEWIRE_REMOTE` overrides),
|
||||
`$XDG_RUNTIME_DIR/bus` when present for desktop appearance settings, and
|
||||
`$XDG_RUNTIME_DIR/bus` when present for desktop appearance settings,
|
||||
`$XDG_RUNTIME_DIR/moonmix` (browser tab names) read-only, and
|
||||
whichever standard host icon, pixmap and `.desktop` directories exist
|
||||
(`/usr/share/{icons,pixmaps,applications}`, Flatpak exports and
|
||||
`$XDG_DATA_HOME/{icons,applications}`) read-only under `/run/moonmix/host/`.
|
||||
@@ -308,7 +353,8 @@ tools/smoke-test.sh /tmp/shot # needs pipewire, wireplumber, pw-cat, gtk4-
|
||||
`XDG_RUNTIME_DIR`. The instance has two null sinks, a loopback virtual
|
||||
microphone, one playback stream of noise and one capture stream created with `pw-cat`; the CLI is used only
|
||||
by the test harness. The script runs every probe action and checks its effect, checks that peak
|
||||
meters on the stream and its sink see the signal,
|
||||
meters on the stream and its sink see the signal, checks tab naming with a
|
||||
fake browser (`tools/fake-browser.py`),
|
||||
then starts the GUI under GTK's broadway backend. With `MOONMIX_SCREENSHOT`
|
||||
set, the GUI renders each tab offscreen to a PNG and exits. If `python3`
|
||||
with PyGObject and `dbus-daemon` are available, it then starts a private
|
||||
|
||||
Reference in new issue
Block a user