Skip to content

Commit

Permalink
feat(core): set gtk app id (#9621)
Browse files Browse the repository at this point in the history
* feat(core): set gtk app id

ref: tauri-apps/tao#910

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

* Discard changes to Cargo.lock
  • Loading branch information
amrbashir authored Jun 24, 2024
1 parent faf282c commit 669b9c6
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .changes/linux-gtk-app-id.md
Original file line number Diff line number Diff line change
@@ -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.

12 changes: 12 additions & 0 deletions core/tauri-runtime-wry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}

Expand Down
8 changes: 8 additions & 0 deletions core/tauri-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>>,
}
Expand Down
9 changes: 9 additions & 0 deletions core/tauri/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 669b9c6

Please sign in to comment.