Skip to content

Commit 669b9c6

Browse files
authored
feat(core): set gtk app id (#9621)
* feat(core): set gtk app id ref: tauri-apps/tao#910 * Update core/tauri-runtime-wry/Cargo.toml * Discard changes to Cargo.lock
1 parent faf282c commit 669b9c6

File tree

4 files changed

+36
-0
lines changed

4 files changed

+36
-0
lines changed

.changes/linux-gtk-app-id.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"tauri": "patch:enhance"
3+
"tauri-runtime-wry": "patch"
4+
---
5+
6+
Set the gtk application to the identifier defined in `tauri.conf.json` to ensure the app uniqueness.
7+

core/tauri-runtime-wry/src/lib.rs

+12
Original file line numberDiff line numberDiff line change
@@ -2245,6 +2245,18 @@ impl<T: UserEvent> Wry<T> {
22452245
use tao::platform::windows::EventLoopBuilderExtWindows;
22462246
event_loop_builder.with_msg_hook(hook);
22472247
}
2248+
2249+
#[cfg(any(
2250+
target_os = "linux",
2251+
target_os = "dragonfly",
2252+
target_os = "freebsd",
2253+
target_os = "netbsd",
2254+
target_os = "openbsd"
2255+
))]
2256+
if let Some(app_id) = args.app_id {
2257+
use tao::platform::unix::EventLoopBuilderExtUnix;
2258+
event_loop_builder.with_app_id(app_id);
2259+
}
22482260
Self::init(event_loop_builder.build())
22492261
}
22502262

core/tauri-runtime/src/lib.rs

+8
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,14 @@ pub trait EventLoopProxy<T: UserEvent>: Debug + Clone + Send + Sync {
339339

340340
#[derive(Default)]
341341
pub struct RuntimeInitArgs {
342+
#[cfg(any(
343+
target_os = "linux",
344+
target_os = "dragonfly",
345+
target_os = "freebsd",
346+
target_os = "netbsd",
347+
target_os = "openbsd"
348+
))]
349+
pub app_id: Option<String>,
342350
#[cfg(windows)]
343351
pub msg_hook: Option<Box<dyn FnMut(*const std::ffi::c_void) -> bool + 'static>>,
344352
}

core/tauri/src/app.rs

+9
Original file line numberDiff line numberDiff line change
@@ -1633,6 +1633,15 @@ tauri::Builder::default()
16331633
));
16341634

16351635
let runtime_args = RuntimeInitArgs {
1636+
#[cfg(any(
1637+
target_os = "linux",
1638+
target_os = "dragonfly",
1639+
target_os = "freebsd",
1640+
target_os = "netbsd",
1641+
target_os = "openbsd"
1642+
))]
1643+
app_id: Some(manager.config.identifier.clone()),
1644+
16361645
#[cfg(windows)]
16371646
msg_hook: {
16381647
let menus = manager.menu.menus.clone();

0 commit comments

Comments
 (0)