Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: move to muda and tray_icon crates #7535

Merged
merged 130 commits into from
Aug 14, 2023
Merged
Show file tree
Hide file tree
Changes from 125 commits
Commits
Show all changes
130 commits
Select commit Hold shift + click to select a range
262f8f7
refactor: migrate to new crates (`muda` & `tray-icon`)
amrbashir Jul 13, 2023
4734c01
update deps to use git
amrbashir Jul 18, 2023
027c940
add tray getters
amrbashir Jul 18, 2023
d71a11c
fix linux impl
lucasfernog Jul 20, 2023
1a75a13
fix gtk api usage
lucasfernog Jul 20, 2023
6758525
lint
lucasfernog Jul 20, 2023
826a5fc
fix build on macos
lucasfernog Jul 20, 2023
d57635d
disable default features for muda and tray-icon
amrbashir Jul 20, 2023
5b13702
Merge branch 'refactor/muda-migration' of https://github.com/tauri-ap…
amrbashir Jul 20, 2023
eaa17cd
remove default file menu on Linux
amrbashir Jul 20, 2023
0063216
use builder on Linux
amrbashir Jul 20, 2023
ae9423b
move menu/tray handlers setup from runtime to tauri
amrbashir Jul 20, 2023
0c53ebc
remove unused messages
lucasfernog Jul 20, 2023
d1b81bf
Merge remote-tracking branch 'origin/dev' into refactor/muda-migration
lucasfernog Jul 20, 2023
37497a1
revert menu changes and enhance docs
amrbashir Jul 20, 2023
80f4f2e
add show_context_menu function
amrbashir Jul 31, 2023
0b235db
inital work for menu wrapper types
amrbashir Jul 31, 2023
e6fbf76
fix build on macos [skip ci]
lucasfernog Jul 31, 2023
35dca0d
ensure thread safety for context items
amrbashir Jul 31, 2023
dd36a38
finish menu wrapper types
amrbashir Jul 31, 2023
a4391ad
add default menu
amrbashir Aug 1, 2023
1cf5788
add tray icon wrapper types
amrbashir Aug 1, 2023
4cedac2
Merge branch 'dev' into refactor/muda-migration
amrbashir Aug 1, 2023
5c8d40b
fix macos build
lucasfernog Aug 1, 2023
9534f6a
lint
lucasfernog Aug 1, 2023
f5b5aac
small fix on api example
lucasfernog Aug 1, 2023
741a2d7
fix linux build
lucasfernog Aug 1, 2023
ad18aac
change `Builder::tray_icon` to be a function
amrbashir Aug 1, 2023
be77871
Add a getter for apphandle
amrbashir Aug 1, 2023
aef5e96
change it to an owned handle
amrbashir Aug 1, 2023
f888fa0
add `on_menu_event` and `on_tray_even` for `TrayIcon` & fix api example
amrbashir Aug 1, 2023
901fe92
update lock file
amrbashir Aug 1, 2023
400269b
macos fixes
lucasfernog Aug 1, 2023
316d2aa
tray id return raw value
lucasfernog Aug 1, 2023
81250dd
lint
lucasfernog Aug 1, 2023
b02b7b1
private fields
lucasfernog Aug 1, 2023
c65820f
replace show_context_menu_for_* with popup fn
lucasfernog Aug 1, 2023
77a5359
make id return u32 instead of result
lucasfernog Aug 1, 2023
8b07b50
fix doctests
lucasfernog Aug 1, 2023
116f6db
fix unix
lucasfernog Aug 1, 2023
468fd31
remove window menu APIs on macos
lucasfernog Aug 1, 2023
e8ea27b
remove `Builder::tray_icon`, move init to `TrayIcon` type itself
amrbashir Aug 2, 2023
cb62300
Remove `with_` prefix from `TrayIconBuilder`
amrbashir Aug 2, 2023
012a681
move `on_menu/tray_icon_event` from `tauri::Builder` to `App/AppHandle`
amrbashir Aug 2, 2023
6948816
Add `on_menu_event` for `WindowBuilder`
amrbashir Aug 2, 2023
70c0bfc
Add `TrayIcon::on_menu_event` and `TrayIcon::on_tray_icon_event`
amrbashir Aug 2, 2023
8b7739f
fix api example
amrbashir Aug 2, 2023
74cc682
take a `Manager` argument instead of just `AppHandle`
amrbashir Aug 2, 2023
6c7155b
add todo
amrbashir Aug 2, 2023
a9c5244
docs & expose `cleanup_before_exit()`
amrbashir Aug 2, 2023
9d4a676
all tauri handlers return result, make it easier to use `?`
amrbashir Aug 2, 2023
8062ddb
remove `TrayIconAttributes`
amrbashir Aug 2, 2023
64b48c3
add missing submenu methods
amrbashir Aug 2, 2023
aa88466
run menu_for_nsapp on main thread
amrbashir Aug 2, 2023
501dda0
make App::run handler also return a result
amrbashir Aug 2, 2023
a9a6850
fix test
amrbashir Aug 2, 2023
0349a38
add menu item builders
amrbashir Aug 2, 2023
40df0d0
fix tray icon builder docs
amrbashir Aug 2, 2023
dc1b949
pin time crate in CI
amrbashir Aug 2, 2023
f4956f3
fix test-core workflow
amrbashir Aug 2, 2023
3fc7a6a
lints and doctests
amrbashir Aug 2, 2023
1e33d62
update tray-icon [skip ci]
lucasfernog Aug 2, 2023
37bd9e6
fix api example build [skip ci]
lucasfernog Aug 2, 2023
7076ce5
expose `popup` on `ContextMenu` trait
amrbashir Aug 2, 2023
575f5c8
rename `Window::show_context_menu` to `Window::popup_menu`
amrbashir Aug 2, 2023
c846285
remove extranouse result return from `MenuBuilder` and `SubmenuBuilde…
amrbashir Aug 2, 2023
0234a20
revert "adding result return to menu/tray/window event handlers"
amrbashir Aug 2, 2023
6b99f3c
fix deadlock
amrbashir Aug 3, 2023
794a68a
move window menu initalization out of tauri-runtime into tauri crate
amrbashir Aug 3, 2023
209ba58
dedup logic
amrbashir Aug 3, 2023
a325675
remove todo
amrbashir Aug 3, 2023
b1b8756
fix ci file
amrbashir Aug 3, 2023
30561ad
fix unix
amrbashir Aug 3, 2023
c17b8f7
fix macos
lucasfernog Aug 3, 2023
cbf411f
fix api build
lucasfernog Aug 3, 2023
f541c48
expose window menu apis on macOS, no-op
amrbashir Aug 3, 2023
80ea1de
Add missing submenu APIs
amrbashir Aug 3, 2023
4ace7f1
fix macos build
amrbashir Aug 3, 2023
78616b4
update deps [skip ci]
lucasfernog Aug 3, 2023
98e6ff4
lint macos
lucasfernog Aug 3, 2023
b431bc2
hide menu APIs behind `#cfg(desktop)]`
amrbashir Aug 3, 2023
0fd9fdf
update api example lockfile
amrbashir Aug 3, 2023
64e931f
disable menu on left click
lucasfernog Aug 3, 2023
a0103c1
focus window
lucasfernog Aug 3, 2023
b26e3b3
implement migration for config and cargo manifest
lucasfernog Aug 3, 2023
a9c57c7
add menu toggle to api example
lucasfernog Aug 3, 2023
412e940
set default menu on api example
lucasfernog Aug 3, 2023
88af6f1
fix logic
lucasfernog Aug 3, 2023
4d9ce78
fix deadlock on windows
lucasfernog Aug 3, 2023
7513e98
update api dist
lucasfernog Aug 3, 2023
ea4a268
split popup functions
lucasfernog Aug 3, 2023
cb05d42
add popup cmd to api example
lucasfernog Aug 3, 2023
0621382
fix macos
lucasfernog Aug 3, 2023
431ace7
update tray-icon
lucasfernog Aug 3, 2023
2e65ed9
update muda
lucasfernog Aug 3, 2023
1c9d911
clippy
lucasfernog Aug 3, 2023
1a821eb
reuse popup menu
lucasfernog Aug 3, 2023
e0282a3
add `ContextMenu::popup_at`
amrbashir Aug 4, 2023
5203e96
Update core/tauri/src/app.rs
amrbashir Aug 4, 2023
3c01907
Add change files
amrbashir Aug 4, 2023
8baab5a
set windows menu on macOS for default menu
amrbashir Aug 4, 2023
f677e79
remvoe default impls for builders and enhance docs
amrbashir Aug 4, 2023
f479346
export builders
lucasfernog Aug 4, 2023
27c023d
use manager.windows() [skip ci]
lucasfernog Aug 5, 2023
4eb031a
fix macos build
lucasfernog Aug 5, 2023
1bdd397
fix api example build for mobile
lucasfernog Aug 5, 2023
235f34c
Update core/tauri/src/menu/mod.rs
amrbashir Aug 8, 2023
84467d4
change app_handle function to return a reference instead
amrbashir Aug 8, 2023
d9ac3fd
update to muda and tray-icon 0.8
amrbashir Aug 8, 2023
1283773
fix ios and android build
amrbashir Aug 8, 2023
6783501
relax bounds
amrbashir Aug 8, 2023
c71665b
fix macos build
amrbashir Aug 8, 2023
d8f08fa
Merge branch 'dev' into refactor/muda-migration
amrbashir Aug 8, 2023
743e0b6
fix macos build
amrbashir Aug 8, 2023
175c536
update lock file
amrbashir Aug 8, 2023
676c690
simplify comparisons [skip ci]
lucasfernog Aug 10, 2023
32aba4d
fix window and help submenu init logic
lucasfernog Aug 10, 2023
6e43081
Merge remote-tracking branch 'origin/dev' into refactor/muda-migration
lucasfernog Aug 10, 2023
e30ffc5
add tray-icon feature flag
amrbashir Aug 10, 2023
3fb8cf0
add `Submenu::get` and use `PartialEq`
amrbashir Aug 10, 2023
8432965
update jni
lucasfernog Aug 11, 2023
88b418a
update wry [skip ci]
lucasfernog Aug 11, 2023
4f65b26
wry 0.31
lucasfernog Aug 13, 2023
9a62c32
update migration
lucasfernog Aug 13, 2023
2c20d6b
do not enable tray-icon by default
lucasfernog Aug 13, 2023
6842939
enhance docs
lucasfernog Aug 13, 2023
eed1878
Merge branch 'dev' into refactor/muda-migration
lucasfernog Aug 13, 2023
f1f1bf0
fix tray detection
lucasfernog Aug 14, 2023
440d45e
Merge remote-tracking branch 'origin/refactor/muda-migration' into re…
lucasfernog Aug 14, 2023
fb73c96
fix logic
lucasfernog Aug 14, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changes/config-tray-icon-tooltip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'tauri-utils': 'minor:feat'
---

Add option to specify a tooltip text for the tray icon in the config.
5 changes: 5 additions & 0 deletions .changes/config-tray-icon.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'tauri-utils': 'major:breaking'
---

`systemTray` config option has been renamed to `trayIcon`.
6 changes: 6 additions & 0 deletions .changes/runtime-create-window-handler.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'tauri-runtime': 'minor:breaking'
'tauri-runtime-wry': 'minor:breaking'
---

`Dispatch::create_window`, `Runtime::create_window` and `RuntimeHandle::create_window` has been changed to accept a 3rd parameter which is a closure that takes `RawWindow` and to be executed right after the window is created and before the webview is added to the window.
5 changes: 5 additions & 0 deletions .changes/runtime-defaultvbox.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'tauri-runtime-wry': 'minor:feat'
---

Add `Dispatch::default_vbox`
6 changes: 6 additions & 0 deletions .changes/runtime-menu-system-tray.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'tauri-runtime': 'major:breaking'
'tauri-runtime-wry': 'major:breaking'
---

System tray and menu related APIs and structs have all been removed and are now implemented in tauri outside of the runtime-space.
6 changes: 6 additions & 0 deletions .changes/runtime-new-args.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'tauri-runtime': 'minor:breaking'
'tauri-runtime-wry': 'minor:breaking'
---

`Runtime::new` and `Runtime::new_any_thread` now accept a `RuntimeInitArgs`.
6 changes: 6 additions & 0 deletions .changes/system-tray-feat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'tauri-runtime': 'major:breaking'
'tauri-runtime-wry': 'major:breaking'
---

Removed `system-tray` feature flag
5 changes: 5 additions & 0 deletions .changes/tauri-app-handle-ref.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'tauri': 'major:breaking'
---

Changed `App::handle` and `Manager::app_handle` to return a reference to an `AppHandle` instead of an owned value.
5 changes: 5 additions & 0 deletions .changes/tauri-cleanup-before-exit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'tauri': 'minor:feat'
---

Add `App::cleanup_before_exit` and `AppHandle::cleanup_before_exit` to manually call the cleanup logic. **You should always exit the tauri app immediately after this function returns and not use any tauri-related APIs.**
5 changes: 5 additions & 0 deletions .changes/tauri-defaultvbox.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'tauri': 'minor:feat'
---

On Linux, add `Window::default_vbox` to get a reference to the `gtk::Box` that contains the menu bar and the webview.
5 changes: 5 additions & 0 deletions .changes/tauri-libxdo-feat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'tauri': 'minor:feat'
---

Add `linux-libxdo` feature flag (disabled by default) to enable linking to `libxdo` which is used to make `Cut`, `Copy`, `Paste` and `SelectAll` native menu items work on Linux.
17 changes: 17 additions & 0 deletions .changes/tauri-menu-tray-refactor.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
'tauri': 'major:breaking'
---

The tray icon and menu have received a huge refactor with a lot of breaking changes in order to add new functionalities and improve the DX around using them and here is an overview of the changes:

- All menu and tray types are now exported from `tauri::menu` and `tauri::tray` modules with new names so make sure to check the new types.
- Removed `tauri::Builder::system_tray`, instead you should use `tauri::tray::TrayIconBuilder` inside `tauri::Builder::setup` hook to create your tray icons.
- Changed `tauri::Builder::menu` to be a function to accomodate for new menu changes, you can passe `tauri::menu::Menu::default` to it to create a default menu.
- Renamed `tauri::Context` methods `system_tray_icon`, `tauri::Context::system_tray_icon_mut` and `tauri::Context::set_system_tray_icon` to `tauri::Context::tray_icon`, `tauri::Context::tray_icon_mut` and `tauri::Context::set_tray_icon` to be consistent with new type names.
- Added `RunEvent::MenuEvent` and `RunEvent::TrayIconEvent`.
- Added `App/AppHandle::set_menu`, `App/AppHandle::remove_menu`, `App/AppHandle::show_menu`, `App/AppHandle::hide_menu` and `App/AppHandle::menu` to access, remove, hide or show the app-wide menu that is used as the global menu on macOS and on all windows that don't have a specific menu set for it on Windows and Linux.
- Added `Window::set_menu`, `Window::remove_menu`, `Window::show_menu`, `Window::hide_menu`, `Window::is_menu_visible` and `Window::menu` to access, remove, hide or show the menu on this window.
- Added `Window::popup_menu` and `Window::popup_menu_at` to show a context menu on the window at the cursor position or at a specific position. You can also popup a context menu using `popup` and `popup_at` methods from `ContextMenu` trait which is implemented for `Menu` and `Submenu` types.
- Added `App/AppHandle::tray`, `App/AppHandle::tray_by_id`, `App/AppHandle::remove_tray` and `App/AppHandle::remove_tray_by_id` to access or remove a registered tray.
- Added `WindowBuilder/App/AppHandle::on_menu_event` to register a new menu event handler.
- Added `App/AppHandle::on_tray_icon_event` to register a new tray event handler.
5 changes: 5 additions & 0 deletions .changes/tauri-nsview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'tauri': 'minor:feat'
---

On macOS, add `Window::ns_view` to get a pointer to the NSWindow content view.
5 changes: 5 additions & 0 deletions .changes/tauri-run_on_main_thread.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'tauri': 'minor:feat'
---

Expose `run_on_main_thread` method on `App` that is similar to `AppHandle::run_on_main_thread`.
5 changes: 5 additions & 0 deletions .changes/tauri-tray-icon-feat-flag.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'tauri': 'major:breaking'
---

Renamed `system-tray` feature flag to `tray-icon`.
2 changes: 1 addition & 1 deletion .github/workflows/lint-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
clippy:
- { args: '', key: 'empty' }
- {
args: '--features compression,wry,isolation,custom-protocol,system-tray,test',
args: '--features compression,wry,linux-ipc-protocol,isolation,custom-protocol,tray-icon,test',
key: 'all'
}
- { args: '--features custom-protocol', key: 'custom-protocol' }
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
key: no-default
}
- {
args: --features compression,wry,isolation,custom-protocol,system-tray,test,
args: --features compression,wry,linux-ipc-protocol,isolation,custom-protocol,tray-icon,test,
key: all
}

Expand Down
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ exclude = [
# examples that can be compiled with the tauri CLI
"examples/api/src-tauri",
"examples/resources/src-tauri",
"examples/sidecar/src-tauri",
"examples/web/core",
"examples/file-associations/src-tauri",
"examples/workspace",
Expand Down
7 changes: 6 additions & 1 deletion core/tauri-build/src/allowlist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ pub fn check(config: &Config, manifest: &mut Manifest) -> Result<()> {
name: "tauri".into(),
alias: None,
kind: DependencyKind::Normal,
all_cli_managed_features: Some(TauriConfig::all_features()),
all_cli_managed_features: Some(
TauriConfig::all_features()
.into_iter()
.filter(|f| f != &"tray-icon")
.collect(),
),
amrbashir marked this conversation as resolved.
Show resolved Hide resolved
expected_features: config
.tauri
.features()
Expand Down
2 changes: 1 addition & 1 deletion core/tauri-build/src/codegen/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ impl CodegenContext {
config_parent.join(icon).display()
);
}
if let Some(tray_icon) = config.tauri.system_tray.as_ref().map(|t| &t.icon_path) {
if let Some(tray_icon) = config.tauri.tray_icon.as_ref().map(|t| &t.icon_path) {
println!(
"cargo:rerun-if-changed={}",
config_parent.join(tray_icon).display()
Expand Down
10 changes: 4 additions & 6 deletions core/tauri-build/src/mobile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ fn insert_into_xml(xml: &str, block_identifier: &str, parent_tag: &str, contents
rewritten.push(line.to_string());
}

rewritten.join("\n").to_string()
rewritten.join("\n")
}

pub fn update_android_manifest(block_identifier: &str, parent: &str, insert: String) -> Result<()> {
Expand Down Expand Up @@ -294,16 +294,14 @@ dependencies {"
mod tests {
#[test]
fn insert_into_xml() {
let manifest = format!(
r#"<manifest>
let manifest = r#"<manifest>
<application>
<intent-filter>
</intent-filter>
</application>
</manifest>"#
);
</manifest>"#;
let id = "tauritest";
let new = super::insert_into_xml(&manifest, id, "application", "<something></something>");
let new = super::insert_into_xml(manifest, id, "application", "<something></something>");

let block_id_comment = super::xml_block_comment(id);
let expected = format!(
Expand Down
2 changes: 1 addition & 1 deletion core/tauri-codegen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Tauri apps can have custom menus and have tray-type interfaces. They can be upda

## This module

- Embed, hash, and compress assets, including icons for the app as well as the system-tray.
- Embed, hash, and compress assets, including icons for the app as well as the tray icon.
- Parse `tauri.conf.json` at compile time and generate the Config struct.

To learn more about the details of how all of these pieces fit together, please consult this [ARCHITECTURE.md](https://github.com/tauri-apps/tauri/blob/dev/ARCHITECTURE.md) document.
Expand Down
24 changes: 11 additions & 13 deletions core/tauri-codegen/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,17 +264,15 @@ pub fn context_codegen(data: ContextData) -> Result<TokenStream, EmbeddedAssetsE
);
png_icon(&root, &out_dir, icon_path).map(|i| quote!(::std::option::Option::Some(#i)))?
}
} else if target == Target::Linux {
// handle default window icons for Linux targets
} else {
// handle default window icons for Unix targets
let icon_path = find_icon(
&config,
&config_parent,
|i| i.ends_with(".png"),
"icons/icon.png",
);
png_icon(&root, &out_dir, icon_path).map(|i| quote!(::std::option::Option::Some(#i)))?
} else {
quote!(::std::option::Option::None)
}
};

Expand Down Expand Up @@ -319,16 +317,16 @@ pub fn context_codegen(data: ContextData) -> Result<TokenStream, EmbeddedAssetsE
}
);

let with_system_tray_icon_code = if target.is_desktop() {
if let Some(tray) = &config.tauri.system_tray {
let system_tray_icon_path = config_parent.join(&tray.icon_path);
let ext = system_tray_icon_path.extension();
let with_tray_icon_code = if target.is_desktop() {
if let Some(tray) = &config.tauri.tray_icon {
let tray_icon_icon_path = config_parent.join(&tray.icon_path);
let ext = tray_icon_icon_path.extension();
if ext.map_or(false, |e| e == "ico") {
ico_icon(&root, &out_dir, system_tray_icon_path)
.map(|i| quote!(context.set_system_tray_icon(#i);))?
ico_icon(&root, &out_dir, tray_icon_icon_path)
.map(|i| quote!(context.set_tray_icon(#i);))?
} else if ext.map_or(false, |e| e == "png") {
png_icon(&root, &out_dir, system_tray_icon_path)
.map(|i| quote!(context.set_system_tray_icon(#i);))?
png_icon(&root, &out_dir, tray_icon_icon_path)
.map(|i| quote!(context.set_tray_icon(#i);))?
} else {
quote!(compile_error!(
"The tray icon extension must be either `.ico` or `.png`."
Expand Down Expand Up @@ -432,7 +430,7 @@ pub fn context_codegen(data: ContextData) -> Result<TokenStream, EmbeddedAssetsE
#info_plist,
#pattern,
);
#with_system_tray_icon_code
#with_tray_icon_code
context
}))
}
Expand Down
2 changes: 1 addition & 1 deletion core/tauri-codegen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

//! [![](https://github.com/tauri-apps/tauri/raw/dev/.github/splash.png)](https://tauri.app)
//!
//! - Embed, hash, and compress assets, including icons for the app as well as the system-tray.
//! - Embed, hash, and compress assets, including icons for the app as well as the tray icon.
//! - Parse `tauri.conf.json` at compile time and generate the Config struct.

#![doc(
Expand Down
21 changes: 14 additions & 7 deletions core/tauri-config-schema/schema.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Config",
"description": "The Tauri configuration object. It is read from a file where you can define your frontend assets, configure the bundler and define a system tray.\n\nThe configuration file is generated by the [`tauri init`](https://tauri.app/v1/api/cli#init) command that lives in your Tauri application source directory (src-tauri).\n\nOnce generated, you may modify it at will to customize your Tauri application.\n\n## File Formats\n\nBy default, the configuration is defined as a JSON file named `tauri.conf.json`.\n\nTauri also supports JSON5 and TOML files via the `config-json5` and `config-toml` Cargo features, respectively. The JSON5 file name must be either `tauri.conf.json` or `tauri.conf.json5`. The TOML file name is `Tauri.toml`.\n\n## Platform-Specific Configuration\n\nIn addition to the default configuration file, Tauri can read a platform-specific configuration from `tauri.linux.conf.json`, `tauri.windows.conf.json`, `tauri.macos.conf.json`, `tauri.android.conf.json` and `tauri.ios.conf.json` (or `Tauri.linux.toml`, `Tauri.windows.toml`, `Tauri.macos.toml`, `Tauri.android.toml` and `Tauri.ios.toml` if the `Tauri.toml` format is used), which gets merged with the main configuration object.\n\n## Configuration Structure\n\nThe configuration is composed of the following objects:\n\n- [`package`](#packageconfig): Package settings - [`tauri`](#tauriconfig): The Tauri config - [`build`](#buildconfig): The build configuration - [`plugins`](#pluginconfig): The plugins config\n\n```json title=\"Example tauri.config.json file\" { \"build\": { \"beforeBuildCommand\": \"\", \"beforeDevCommand\": \"\", \"devPath\": \"../dist\", \"distDir\": \"../dist\" }, \"package\": { \"productName\": \"tauri-app\", \"version\": \"0.1.0\" }, \"tauri\": { \"bundle\": {}, \"security\": { \"csp\": null }, \"windows\": [ { \"fullscreen\": false, \"height\": 600, \"resizable\": true, \"title\": \"Tauri App\", \"width\": 800 } ] } } ```",
"description": "The Tauri configuration object. It is read from a file where you can define your frontend assets, configure the bundler and define a tray icon.\n\nThe configuration file is generated by the [`tauri init`](https://tauri.app/v1/api/cli#init) command that lives in your Tauri application source directory (src-tauri).\n\nOnce generated, you may modify it at will to customize your Tauri application.\n\n## File Formats\n\nBy default, the configuration is defined as a JSON file named `tauri.conf.json`.\n\nTauri also supports JSON5 and TOML files via the `config-json5` and `config-toml` Cargo features, respectively. The JSON5 file name must be either `tauri.conf.json` or `tauri.conf.json5`. The TOML file name is `Tauri.toml`.\n\n## Platform-Specific Configuration\n\nIn addition to the default configuration file, Tauri can read a platform-specific configuration from `tauri.linux.conf.json`, `tauri.windows.conf.json`, `tauri.macos.conf.json`, `tauri.android.conf.json` and `tauri.ios.conf.json` (or `Tauri.linux.toml`, `Tauri.windows.toml`, `Tauri.macos.toml`, `Tauri.android.toml` and `Tauri.ios.toml` if the `Tauri.toml` format is used), which gets merged with the main configuration object.\n\n## Configuration Structure\n\nThe configuration is composed of the following objects:\n\n- [`package`](#packageconfig): Package settings - [`tauri`](#tauriconfig): The Tauri config - [`build`](#buildconfig): The build configuration - [`plugins`](#pluginconfig): The plugins config\n\n```json title=\"Example tauri.config.json file\" { \"build\": { \"beforeBuildCommand\": \"\", \"beforeDevCommand\": \"\", \"devPath\": \"../dist\", \"distDir\": \"../dist\" }, \"package\": { \"productName\": \"tauri-app\", \"version\": \"0.1.0\" }, \"tauri\": { \"bundle\": {}, \"security\": { \"csp\": null }, \"windows\": [ { \"fullscreen\": false, \"height\": 600, \"resizable\": true, \"title\": \"Tauri App\", \"width\": 800 } ] } } ```",
"type": "object",
"properties": {
"$schema": {
Expand Down Expand Up @@ -223,11 +223,11 @@
}
]
},
"systemTray": {
"description": "Configuration for app system tray.",
"trayIcon": {
"description": "Configuration for app tray icon.",
"anyOf": [
{
"$ref": "#/definitions/SystemTrayConfig"
"$ref": "#/definitions/TrayIconConfig"
},
{
"type": "null"
Expand Down Expand Up @@ -2065,15 +2065,15 @@
}
]
},
"SystemTrayConfig": {
"description": "Configuration for application system tray icon.\n\nSee more: https://tauri.app/v1/api/config#systemtrayconfig",
"TrayIconConfig": {
"description": "Configuration for application tray icon.\n\nSee more: https://tauri.app/v1/api/config#trayiconconfig",
"type": "object",
"required": [
"iconPath"
],
"properties": {
"iconPath": {
"description": "Path to the default icon to use on the system tray.",
"description": "Path to the default icon to use for the tray icon.",
"type": "string"
},
"iconAsTemplate": {
Expand All @@ -2092,6 +2092,13 @@
"string",
"null"
]
},
"tooltip": {
"description": "Tray icon tooltip on Windows and macOS",
"type": [
"string",
"null"
]
}
},
"additionalProperties": false
Expand Down
11 changes: 5 additions & 6 deletions core/tauri-runtime-wry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ edition = { workspace = true }
rust-version = { workspace = true }

[dependencies]
wry = { version = "0.30", default-features = false, features = [ "file-drop", "protocol" ] }
wry = { version = "0.31", default-features = false, features = [ "file-drop", "protocol" ] }
tauri-runtime = { version = "0.13.0-alpha.6", path = "../tauri-runtime" }
tauri-utils = { version = "2.0.0-alpha.6", path = "../tauri-utils" }
uuid = { version = "1", features = [ "v4" ] }
Expand All @@ -23,9 +23,9 @@ raw-window-handle = "0.5"
[target."cfg(windows)".dependencies]
webview2-com = "0.25"

[target."cfg(windows)".dependencies.windows]
version = "0.48"
features = [ "Win32_Foundation" ]
[target."cfg(windows)".dependencies.windows]
version = "0.48"
features = [ "Win32_Foundation" ]

[target."cfg(any(target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies]
gtk = { version = "0.16", features = [ "v3_24" ] }
Expand All @@ -36,12 +36,11 @@ percent-encoding = "2.1"
cocoa = "0.24"

[target."cfg(target_os = \"android\")".dependencies]
jni = "0.20"
jni = "0.21"

[features]
dox = [ "wry/dox" ]
devtools = [ "wry/devtools", "tauri-runtime/devtools" ]
system-tray = [ "tauri-runtime/system-tray", "wry/tray" ]
macos-private-api = [
"wry/fullscreen",
"wry/transparent",
Expand Down
Loading