Skip to content

Commit 7aeac39

Browse files
vlaboFabianLars
andauthored
feat(core): make setting of gtk app id optional (#10397)
* feat(core): make setting of gtk app id optional * Fix change file * Update .changes/linux-option-gtk-app-id.md Co-authored-by: Fabian-Lars <fabianlars@fabianlars.de> * [skip ci] Update linux-option-gtk-app-id.md * Update app.rs * Update app.rs --------- Co-authored-by: Fabian-Lars <fabianlars@fabianlars.de>
1 parent 498f405 commit 7aeac39

6 files changed

Lines changed: 33 additions & 2 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"tauri-utils": "patch:enhance"
3+
"tauri": "patch:enhance"
4+
---
5+
6+
Make the set of gtk application id optional, to allow more then one instance of the app running at the same time.

‎core/tauri-config-schema/schema.json‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"app": {
3535
"description": "The App configuration.",
3636
"default": {
37+
"enableGTKAppId": false,
3738
"macOSPrivateApi": false,
3839
"security": {
3940
"assetProtocol": {
@@ -195,6 +196,11 @@
195196
"description": "Whether we should inject the Tauri API on `window.__TAURI__` or not.",
196197
"default": false,
197198
"type": "boolean"
199+
},
200+
"enableGTKAppId": {
201+
"description": "If set to true \"identifier\" will be set as GTK app ID (on systems that use GTK).",
202+
"default": false,
203+
"type": "boolean"
198204
}
199205
},
200206
"additionalProperties": false

‎core/tauri-utils/src/config.rs‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1803,6 +1803,9 @@ pub struct AppConfig {
18031803
/// Whether we should inject the Tauri API on `window.__TAURI__` or not.
18041804
#[serde(default, alias = "with-global-tauri")]
18051805
pub with_global_tauri: bool,
1806+
/// If set to true "identifier" will be set as GTK app ID (on systems that use GTK).
1807+
#[serde(rename = "enableGTKAppId", alias = "enable-gtk-app-id", default)]
1808+
pub enable_gtk_app_id: bool,
18061809
}
18071810

18081811
impl AppConfig {
@@ -2732,6 +2735,7 @@ mod build {
27322735
let tray_icon = opt_lit(self.tray_icon.as_ref());
27332736
let macos_private_api = self.macos_private_api;
27342737
let with_global_tauri = self.with_global_tauri;
2738+
let enable_gtk_app_id = self.enable_gtk_app_id;
27352739

27362740
literal_struct!(
27372741
tokens,
@@ -2740,7 +2744,8 @@ mod build {
27402744
security,
27412745
tray_icon,
27422746
macos_private_api,
2743-
with_global_tauri
2747+
with_global_tauri,
2748+
enable_gtk_app_id
27442749
);
27452750
}
27462751
}
@@ -2817,6 +2822,7 @@ mod test {
28172822
tray_icon: None,
28182823
macos_private_api: false,
28192824
with_global_tauri: false,
2825+
enable_gtk_app_id: false,
28202826
};
28212827

28222828
// create a build config

‎core/tauri/src/app.rs‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1706,6 +1706,12 @@ tauri::Builder::default()
17061706
self.invoke_key,
17071707
));
17081708

1709+
let app_id = if manager.config.app.enable_gtk_app_id {
1710+
Some(manager.config.identifier.clone())
1711+
} else {
1712+
None
1713+
};
1714+
17091715
let runtime_args = RuntimeInitArgs {
17101716
#[cfg(any(
17111717
target_os = "linux",
@@ -1714,7 +1720,7 @@ tauri::Builder::default()
17141720
target_os = "netbsd",
17151721
target_os = "openbsd"
17161722
))]
1717-
app_id: Some(manager.config.identifier.clone()),
1723+
app_id,
17181724

17191725
#[cfg(windows)]
17201726
msg_hook: {

‎core/tauri/src/test/mod.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ pub fn mock_context<R: Runtime, A: Assets<R>>(assets: A) -> crate::Context<R> {
113113
security: Default::default(),
114114
tray_icon: None,
115115
macos_private_api: false,
116+
enable_gtk_app_id: false,
116117
},
117118
bundle: Default::default(),
118119
build: Default::default(),

‎tooling/cli/schema.json‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"app": {
3535
"description": "The App configuration.",
3636
"default": {
37+
"enableGTKAppId": false,
3738
"macOSPrivateApi": false,
3839
"security": {
3940
"assetProtocol": {
@@ -195,6 +196,11 @@
195196
"description": "Whether we should inject the Tauri API on `window.__TAURI__` or not.",
196197
"default": false,
197198
"type": "boolean"
199+
},
200+
"enableGTKAppId": {
201+
"description": "If set to true \"identifier\" will be set as GTK app ID (on systems that use GTK).",
202+
"default": false,
203+
"type": "boolean"
198204
}
199205
},
200206
"additionalProperties": false

0 commit comments

Comments
 (0)