Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/app-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ jobs:
libayatana-appindicator3-dev \
libgtk-3-dev \
libmpv-dev \
libpulse-dev \
librsvg2-dev \
libssl-dev \
libudev-dev \
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ jobs:
libayatana-appindicator3-dev \
libgtk-3-dev \
libmpv-dev \
libpulse-dev \
librsvg2-dev \
libssl-dev \
libudev-dev \
Expand Down
28 changes: 28 additions & 0 deletions src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ webview2-com = "0.39"
[target.'cfg(target_os = "linux")'.dependencies]
gtk = { version = "0.18", features = ["v3_24"] }
zbus = { version = "5", default-features = false, features = ["tokio"] }
libpulse-binding = "2.30"


[dev-dependencies]
Expand Down
19 changes: 18 additions & 1 deletion src-tauri/src/mpv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,23 @@ fn mpv_header_field(name: &str, value: &str) -> String {
format!("{name}: {value}").replace('\\', "\\\\").replace(',', "\\,")
}

// The PulseAudio client name is also how song_id identifies our playback on
// Linux. Flatpak instances can share a sandbox PID, so PID alone cannot
// distinguish their streams. A stable, per-process UUID avoids that collision.
#[cfg(target_os = "linux")]
pub(crate) fn audio_client_name() -> &'static str {
use std::sync::OnceLock;

static NAME: OnceLock<String> = OnceLock::new();
NAME.get_or_init(|| format!("Harbor {}", uuid::Uuid::new_v4().simple()))
.as_str()
}

#[cfg(not(target_os = "linux"))]
pub(crate) fn audio_client_name() -> &'static str {
"Harbor"
}

fn apply_pre_init(
init: &MpvInitializer,
args: &MpvStartArgs,
Expand Down Expand Up @@ -459,7 +476,7 @@ fn apply_pre_init(
.unwrap_or_default();
let joined_init_only = join_init_only_pairs(&init_only_pairs);
set("title", "Harbor");
set("audio-client-name", "Harbor");
set("audio-client-name", audio_client_name());
set("terminal", "no");
set("log-file", "");
set("msg-level", "all=warn,vo=v,d3d11=v,gpu=v,win32=v");
Expand Down
Loading
Loading