feat: add audio device switcher to bar - #131
Open
flathead wants to merge 3 commits into
Open
Conversation
Add a bar button for switching audio output/input devices with a popup selector. Device type icons (headphones, speakers, HDMI, mic) are determined dynamically from PipeWire node properties instead of hardcoded name matching. Includes settings integration: - Toggle to show/hide the switcher - Comma-separated exclusion list to hide unwanted sinks from the popup New files: - modules/bar/AudioDeviceSwitcher.qml Modified files: - modules/bar/BarContent.qml - config/Config.qml - modules/widgets/dashboard/controls/ShellPanel.qml - modules/widgets/dashboard/controls/SettingsIndex.qml
Owner
|
Nice, please add some screenshots. :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a bar button for switching audio output/input devices with a popup selector.
What was added
New file
modules/bar/AudioDeviceSwitcher.qml-- bar button that:Device type detection
Icons are assigned dynamically from PipeWire node properties, not hardcoded names:
speakerHighdevice.profile.namecontains hdmi or displayportheadphonesdevice.busis usb or bluetooth, or headset/headphone profilefadersnode.virtual=trueorapplication.idmatches easyeffects, carla, jamesdsp, pulseeffectsnode.driver-idtraced to real device, classified by its propertiesspeakermicSettings integration
config/Config.qml-- addedshowAudioDeviceSwitcher(bool, default true) andexcludedAudioSinks(string list, default empty) to the bar adapter.modules/widgets/dashboard/controls/ShellPanel.qml-- added to Bar section:modules/widgets/dashboard/controls/SettingsIndex.qml-- added search entries for "Audio Device Switcher" and "Excluded Audio Sinks".Modified files
modules/bar/BarContent.qml-- addedAudioDeviceSwitchervia Loader in both horizontal and vertical layouts, betweenControlsButtonandBatteryIndicator. Visibility controlled byConfig.bar.showAudioDeviceSwitcher.Demo
2026-04-01T21-22-02-413Z.mp4
Install as a mod
Requires the native manager from PR #230. Paste the package link into Settings → Mods → Package source:
The package needs
community.i18n(PR #134) for its popup and Settings strings. The details pane marks that requirement as missing, disabled, or ready, and Install required mods fetches i18n, enables it first, and leaves this package for you to enable. The same steps from the CLI:The packaged version targets the current
devbase and keeps PipeWire device nodes bound until an asynchronous switch has been dispatched. This includes the follow-up fix for selections that occasionally appeared to do nothing when the popup closed.Merge into Ambxst core
For core review, take this PR's branch: the feature as ordinary Ambxst source on
dev.The package patch is a separate artifact. It targets a tree that already carries the mod manager from PR #230 and the
community.i18npackage, because that is the only tree a mod can be installed on. To reproduce exactly what the manager composes:git remote add flathead https://github.com/flathead/Ambxst.git git fetch flathead feature/mod-manager git switch -c mods/audio-device-switcher flathead/feature/mod-manager git apply --3way ambxst-mod-i18n/patches/feature.patch git apply --3way ambxst-mods/packages/audio-device-switcher/patches/feature.patch go test ./... go vet ./...It adds
AudioDeviceSwitcher.qml, registers it in both bar orientations, and adds its Config, Settings, exclusion list, and search-index entries. If i18n is not part of the core plan, this PR's branch carries the same feature with plain English strings. No mod-specific runtime API is involved after application; this is the same source layout intended for core.Package parity
The package in flathead/ambxst-mods and this branch now carry the same feature code.
AudioDeviceSwitcher.qmldiffers in exactly two lines, where the package calls the translator and this branch uses plain English; the PipeWire node-binding fix is present in both. The Config, bar, and Settings files differ only in their registration lines, because the package is generated on a tree that also carries the mod manager andcommunity.i18n.