feat(core): set gtk app id (#9621)

* feat(core): set gtk app id

ref: https://github.com/tauri-apps/tao/issues/910

* Update core/tauri-runtime-wry/Cargo.toml

* Discard changes to Cargo.lock
This commit is contained in:
Amr Bashir 2024-06-24 19:20:03 +03:00 committed by GitHub
parent faf282ca6c
commit 669b9c6b5a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 36 additions and 0 deletions

View File

@ -0,0 +1,7 @@
---
"tauri": "patch:enhance"
"tauri-runtime-wry": "patch"
---
Set the gtk application to the identifier defined in `tauri.conf.json` to ensure the app uniqueness.

View File

@ -2245,6 +2245,18 @@ impl<T: UserEvent> Wry<T> {
use tao::platform::windows::EventLoopBuilderExtWindows;
event_loop_builder.with_msg_hook(hook);
}
#[cfg(any(
target_os = "linux",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd"
))]
if let Some(app_id) = args.app_id {
use tao::platform::unix::EventLoopBuilderExtUnix;
event_loop_builder.with_app_id(app_id);
}
Self::init(event_loop_builder.build())
}

View File

@ -339,6 +339,14 @@ pub trait EventLoopProxy<T: UserEvent>: Debug + Clone + Send + Sync {
#[derive(Default)]
pub struct RuntimeInitArgs {
#[cfg(any(
target_os = "linux",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd"
))]
pub app_id: Option<String>,
#[cfg(windows)]
pub msg_hook: Option<Box<dyn FnMut(*const std::ffi::c_void) -> bool + 'static>>,
}

View File

@ -1633,6 +1633,15 @@ tauri::Builder::default()
));
let runtime_args = RuntimeInitArgs {
#[cfg(any(
target_os = "linux",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd"
))]
app_id: Some(manager.config.identifier.clone()),
#[cfg(windows)]
msg_hook: {
let menus = manager.menu.menus.clone();