diff --git a/src/lib.rs b/src/lib.rs index e051a68..e19d7f8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -93,6 +93,13 @@ pub struct Args { pub ra_password: Option, } +#[cfg(feature = "gui")] +fn set_app_id() { + if let Err(e) = slint::set_xdg_app_id(ui::APP_ID) { + eprintln!("Could not set application ID: {}", e); + } +} + pub async fn run(args: Args, arg_count: usize) -> std::io::Result<()> { let dirs = ui::get_dirs(); @@ -299,6 +306,7 @@ pub async fn run(args: Args, arg_count: usize) -> std::io::Result<()> { #[cfg(feature = "gui")] { let app = ui::gui::AppWindow::new().unwrap(); + set_app_id(); ui::gui::app_window(&app, false); } } diff --git a/src/ui.rs b/src/ui.rs index 0a9aa1f..ede5ef0 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -17,6 +17,8 @@ pub mod video; #[cfg(all(feature = "gui", not(target_os = "android")))] pub mod vru; +pub const APP_ID: &str = "io.github.gopher64.gopher64"; + pub static WEB_CLIENT: std::sync::LazyLock = std::sync::LazyLock::new(|| { reqwest::Client::builder() .user_agent(format!( @@ -113,6 +115,8 @@ pub fn sdl_hints() { sdl3_sys::everything::SDL_HINT_ANDROID_ALLOW_RECREATE_ACTIVITY, hint.as_ptr(), ); + let app_id = std::ffi::CString::new(APP_ID).unwrap(); + sdl3_sys::everything::SDL_SetHint(sdl3_sys::everything::SDL_HINT_APP_ID, app_id.as_ptr()); } }