diff --git a/CHANGELOG.md b/CHANGELOG.md index 963fbac3..381106c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * On large libraries (reported with ~200,000 tracks on Navidrome), background library sync could lock up database writes for minutes at a time — playback history, ratings and other saves piled up waiting behind it. * Root cause: the track id-remap step ran a database lookup that couldn't use its indexes and scanned the entire track table once per incoming track, so the cost grew with the square of the library size. The lookup now uses the proper indexes, bringing it back to a fast, near-instant operation. +### Windows media controls showed "Unknown application" + +* On Windows, the system media controls (the Quick Settings media tile, the lock screen and third-party media flyouts) labelled playback as "Unknown application" with no icon. The app now registers an explicit application identity at startup so Windows shows "Psysonic" and its icon as the playback source. + ## [1.48.0] diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 94866281..7f3153e8 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -64,7 +64,28 @@ fn on_second_instance( } } +/// Windows: associate this process with an explicit AppUserModelID. Windows uses +/// it to name the app in taskbar grouping and the SMTC media controls; without it +/// the media tile reads "Unknown application". Must match the AppUserModelID the +/// installer sets on the Start-menu shortcut so the name/icon resolve. +#[cfg(target_os = "windows")] +fn set_app_user_model_id() { + use windows::core::w; + use windows::Win32::UI::Shell::SetCurrentProcessExplicitAppUserModelID; + // SAFETY: a Win32 call with a static wide string; errors are non-fatal. + unsafe { + let _ = SetCurrentProcessExplicitAppUserModelID(w!("dev.psysonic.player")); + } +} + pub fn run() { + // Windows: bind this process to an explicit AppUserModelID before any window + // or the SMTC media controls are created, so the OS can resolve the app + // name/icon for taskbar grouping and the media tile (#1102 follow-up: the + // Quick-Settings / lock-screen media tile showed "Unknown application"). + #[cfg(target_os = "windows")] + set_app_user_model_id(); + // Linux: second `psysonic --player …` forwards over D-Bus before heavy startup. #[cfg(target_os = "linux")] {