diff --git a/config/tests/schema.rs b/config/tests/schema.rs index 72d6420..8a4c573 100644 --- a/config/tests/schema.rs +++ b/config/tests/schema.rs @@ -2,6 +2,7 @@ use fader_config::{DeviceProfile, PersistedState, Profile, StartupPolicy}; use fader_core::{StreamMetadata, VolumeMode}; const EXAMPLE: &str = include_str!("../../examples/profiles/desktop.toml"); +const ARCH_PIPEWIRE: &str = include_str!("../../examples/profiles/arch-pipewire.toml"); const ARCHITECTURE: &str = include_str!("../../architecture.md"); #[test] @@ -47,6 +48,22 @@ fn validated_profile_exposes_compiled_runtime_application_and_group_views() { assert_eq!(media.volume_mode(), VolumeMode::Absolute); } +#[test] +fn arch_pipewire_profile_matches_reported_qobuz_metadata() { + let profile = Profile::parse(ARCH_PIPEWIRE).expect("Arch profile must validate"); + let music = profile.applications()[0] + .matcher() + .expect("validated music selector compiles"); + assert!( + music.matches( + &StreamMetadata::new() + .with_application_name("PipeWire ALSA [qbz]") + .with_media_name("ALSA Playback") + ) + ); + assert!(!music.matches(&StreamMetadata::new().with_application_name("Firefox"))); +} + #[test] fn rejects_unknown_fields_versions_and_bad_ids_with_context() { let unknown = EXAMPLE.replace("schema_version = 1", "schema_version = 1\nsurprise = true"); diff --git a/examples/profiles/arch-pipewire.toml b/examples/profiles/arch-pipewire.toml new file mode 100644 index 0000000..e9631c5 --- /dev/null +++ b/examples/profiles/arch-pipewire.toml @@ -0,0 +1,30 @@ +schema_version = 1 +id = "arch-pipewire" +startup = "adopt" +new_stream = "adopt" + +[audio] +adapter = "pulse" +max_gain = 1.0 + +[[applications]] +id = "music" +label = "Music" +selectors = [ + { field = "application.name", regex = '(?i)(qobuz|qbz|spotify|music)' }, + { field = "application.process.binary", regex = '(?i)(qobuz|qbz|spotify)' }, +] + +[[applications]] +id = "browser" +label = "Browser" +selectors = [ + { field = "application.name", regex = '(?i)(firefox|chromium|chrome|brave|librewolf)' }, + { field = "application.process.binary", regex = '(?i)^(firefox|chromium|chrome|brave|librewolf)(-.*)?$' }, +] + +[[groups]] +id = "media" +label = "Media group" +members = ["music", "browser"] +volume_mode = "absolute" diff --git a/fader_master/src/main.rs b/fader_master/src/main.rs index c0b90c7..0c6995b 100644 --- a/fader_master/src/main.rs +++ b/fader_master/src/main.rs @@ -108,7 +108,7 @@ fn status(socket_override: Option<&Path>) -> Result<()> { match response.result { ResponseResult::Snapshot { snapshot } => { println!( - "backend={} status={} revision={} streams={}", + "backend={} status={} revision={} objects={}", snapshot.backend, snapshot.status, snapshot.revision,