From 6d63365c2a7b8c24ccaf6f21e2b4aee42c3d57c0 Mon Sep 17 00:00:00 2001 From: Psychotoxical <171614930+Psychotoxical@users.noreply.github.com> Date: Tue, 16 Jun 2026 23:44:11 +0200 Subject: [PATCH] fix(windows): show app name in media controls via AppUserModelID (#1102) The Windows system media controls (Quick Settings media tile, lock screen, third-party media flyouts) labelled playback as "Unknown application" with no icon, because souvlaki creates the SMTC via GetForWindow and Windows resolves the source name from the process AppUserModelID, which was never set. Call SetCurrentProcessExplicitAppUserModelID early in run() so the process has an explicit identity that matches the installer shortcut's AppUserModelID; Windows then resolves the name and icon to Psysonic. (cherry picked from commit 4fd85f2dd415cc3e2ba9dc61839fb9994918f047) --- src-tauri/src/lib.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) 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")] {