set application ID (#998)

This commit is contained in:
Connor Welsh 2026-05-31 17:05:26 -04:00 committed by GitHub
parent cbc973a559
commit cd6726d451
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 0 deletions

View File

@ -93,6 +93,13 @@ pub struct Args {
pub ra_password: Option<String>,
}
#[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);
}
}

View File

@ -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<reqwest::Client> = 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());
}
}