diff --git a/Cargo.lock b/Cargo.lock index e37695827e..d50d4940f8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10876,9 +10876,9 @@ checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f" [[package]] name = "tauri" -version = "2.8.2" +version = "2.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a54629607ea3084a8b455c1ebe888cbdfc4de02fa5edb2e40db0dc97091007e3" +checksum = "dcead52ec80df0e9e4be671c0f2596a1f3bd7b6b2c9418c1eb7dd737499ff4bd" dependencies = [ "anyhow", "bytes 1.10.1", diff --git a/Cargo.toml b/Cargo.toml index 8360d8fd27..171b1e0b69 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -208,8 +208,9 @@ serde_derive = "1.0.219" serde_json = "1.0.140" serde_yaml = "0.9.34+deprecated" sha3 = "0.10.8" -tauri = { version = "2.8.2", features = ["unstable", "devtools"] } # NB: "devtools" prevents App Store distribution +tauri = { version = "2.8.3", features = ["unstable", "devtools"] } # NB: "devtools" prevents App Store distribution; "ubstable" is needed for window access tauri-plugin-dialog = "2.3.3" +tauri-plugin-fs = "2.4.2" tauri-plugin-log = "2.6.0" tauri-plugin-upload = "2.3.1" tempdir = "0.3.7" diff --git a/crates/desktop/artcraft/Cargo.toml b/crates/desktop/artcraft/Cargo.toml index 7b1e44fedd..3c182f9d20 100644 --- a/crates/desktop/artcraft/Cargo.toml +++ b/crates/desktop/artcraft/Cargo.toml @@ -46,31 +46,31 @@ tokens.workspace = true web_base64.workspace = true # External -anyhow = { workspace = true } -base64 = { workspace = true } +anyhow.workspace = true +base64.workspace = true bytes = "1.10.1" -chrono = { workspace = true } +chrono.workspace = true directories = "6.0.0" dirs = "6.0.0" futures = "0.3" image = "0.25.5" -indexmap = { workspace = true } -log = { workspace = true } -once_cell = { workspace = true } -rand = { workspace = true } +indexmap.workspace = true +log.workspace = true +once_cell.workspace = true +rand.workspace = true reqwest = { workspace = true, features = ["multipart", "stream"], default-features = false } # NB(bt,2025-03-10): default-features = false on Windows while I debug openssl / rustls -serde = { workspace = true } -serde_derive = { workspace = true } -serde_json = { workspace = true } +serde.workspace = true +serde_derive.workspace = true +serde_json.workspace = true tauri.workspace = true tauri-plugin-dialog.workspace = true tauri-plugin-log.workspace = true tauri-plugin-upload.workspace = true -tempdir = { workspace = true } -tempfile = { workspace = true } +tempdir.workspace = true +tempfile.workspace = true tokio = { version = "1.42", features = ["rt", "rt-multi-thread", "fs"] } tokio-util = { version = "0.7", features = ["codec"] } -url = { workspace = true } +url.workspace = true # NB: We need to vendor this in so that we can access the cookies inside via the private API tauri-plugin-http = { path = "../../vendor/tauri-plugin-http" } @@ -79,6 +79,12 @@ tauri-plugin-http = { path = "../../vendor/tauri-plugin-http" } # types and can't do threading. We need to wait for a new version to unpin from Git. discord-rich-presence = { git = "https://github.com/vionya/discord-rich-presence" } +# # Transparent title bar on MacOS +# # NB: See the notes here: +# # https://v2.tauri.app/learn/window-customization/ +# [target."cfg(target_os = \"macos\")".dependencies] +# cocoa = "0.26" + [dev-dependencies] serial_test = "3.2.0" diff --git a/crates/desktop/artcraft/capabilities/default.json b/crates/desktop/artcraft/capabilities/default.json index 3f400e29e9..a7b3380d5f 100644 --- a/crates/desktop/artcraft/capabilities/default.json +++ b/crates/desktop/artcraft/capabilities/default.json @@ -5,13 +5,16 @@ "windows": ["main"], "permissions": [ "core:default", - "log:default", - "core:window:allow-minimize", - "core:window:allow-toggle-maximize", "core:window:allow-close", + "core:window:allow-minimize", + "core:window:allow-start-dragging", + "core:window:allow-toggle-maximize", + "core:window:default", + "dialog:default", + "http:allow-fetch", + "log:default", "upload:allow-download", "upload:default", - "http:allow-fetch", { "identifier": "http:default", "allow": [ @@ -22,7 +25,6 @@ "url": "http://localhost:12345" } ] - }, - "dialog:default" + } ] } diff --git a/crates/desktop/artcraft/src/core/lifecycle/startup/mod.rs b/crates/desktop/artcraft/src/core/lifecycle/startup/mod.rs index d50b223b7b..07db4020c0 100644 --- a/crates/desktop/artcraft/src/core/lifecycle/startup/mod.rs +++ b/crates/desktop/artcraft/src/core/lifecycle/startup/mod.rs @@ -1,2 +1,3 @@ +mod tasks; pub mod handle_tauri_startup; -mod tasks; \ No newline at end of file +pub mod setup_main_window; \ No newline at end of file diff --git a/crates/desktop/artcraft/src/core/lifecycle/startup/setup_main_window.rs b/crates/desktop/artcraft/src/core/lifecycle/startup/setup_main_window.rs new file mode 100644 index 0000000000..c2cd7239d3 --- /dev/null +++ b/crates/desktop/artcraft/src/core/lifecycle/startup/setup_main_window.rs @@ -0,0 +1,51 @@ +use tauri::{AppHandle, TitleBarStyle, WebviewUrl, WebviewWindowBuilder}; +use tauri::window::Color; +use errors::AnyhowResult; + +pub async fn setup_main_window( + app: &AppHandle, +) -> AnyhowResult<()> { + + let win_builder = + WebviewWindowBuilder::new(app, "main", WebviewUrl::default()) + .title("Artcraft") + //.decorations(false) // NB: This breaks Mac! + .resizable(true) + .fullscreen(false) + .background_color(Color(0, 0, 0, 0)) + .enable_clipboard_access() + .inner_size(800.0, 600.0); + + // set transparent title bar only when building for macOS + #[cfg(target_os = "macos")] + let win_builder = win_builder + .decorations(true) // NB: Mac requires decorations. Tons of capabilities disappear without it. + .title_bar_style(TitleBarStyle::Overlay) + .hidden_title(true) + .accept_first_mouse(true) // https://github.com/tauri-apps/tauri/issues/11605#issuecomment-2460112096 + .focusable(true) + .focused(true); + + let window = win_builder.build()?; + + /*// set background color only when building for macOS + #[cfg(target_os = "macos")] + { + use cocoa::appkit::{NSColor, NSWindow}; + use cocoa::base::{id, nil}; + + let ns_window = window.ns_window().unwrap() as id; + unsafe { + let bg_color = NSColor::colorWithRed_green_blue_alpha_( + nil, + 50.0 / 255.0, + 158.0 / 255.0, + 163.5 / 255.0, + 0.0, + ); + ns_window.setBackgroundColor_(bg_color); + } + }*/ + + Ok(()) +} \ No newline at end of file diff --git a/crates/desktop/artcraft/src/lib.rs b/crates/desktop/artcraft/src/lib.rs index 3ea90f483f..1e68139d71 100644 --- a/crates/desktop/artcraft/src/lib.rs +++ b/crates/desktop/artcraft/src/lib.rs @@ -18,6 +18,7 @@ use crate::core::commands::platform_info_command::platform_info_command; use crate::core::commands::providers::get_provider_order_command::get_provider_order_command; use crate::core::commands::providers::set_provider_order_command::set_provider_order_command; use crate::core::lifecycle::startup::handle_tauri_startup::handle_tauri_startup; +use crate::core::lifecycle::startup::setup_main_window::setup_main_window; use crate::core::state::app_env_configs::app_env_configs::AppEnvConfigs; use crate::core::state::app_preferences::app_preferences_manager::load_app_preferences_or_default; use crate::core::state::data_dir::app_data_root::AppDataRoot; @@ -121,6 +122,8 @@ pub fn run() { let fal_tasks = fal_task_queue_2.clone(); tauri::async_runtime::block_on(async move { + let result = setup_main_window(&app).await; + let result = handle_tauri_startup( handle, root, diff --git a/crates/desktop/artcraft/tauri.artcraft_3d.no_dev.conf.json b/crates/desktop/artcraft/tauri.artcraft_3d.no_dev.conf.json index fd9005e6bd..07dbef7f3c 100644 --- a/crates/desktop/artcraft/tauri.artcraft_3d.no_dev.conf.json +++ b/crates/desktop/artcraft/tauri.artcraft_3d.no_dev.conf.json @@ -7,13 +7,6 @@ }, "app": { "windows": [ - { - "title": "ArtCraft", - "resizable": true, - "fullscreen": false, - "dragDropEnabled": false, - "decorations": true - } ] } } diff --git a/crates/vendor/tauri-plugin-http/Cargo.toml b/crates/vendor/tauri-plugin-http/Cargo.toml index ad8ac8e2c1..3eeafff3b4 100644 --- a/crates/vendor/tauri-plugin-http/Cargo.toml +++ b/crates/vendor/tauri-plugin-http/Cargo.toml @@ -42,7 +42,7 @@ tauri = { workspace = true } thiserror = { workspace = true } tokio = { version = "1", features = ["sync", "macros"] } #tauri-plugin-fs = { path = "../fs", version = "2.2.1" } -tauri-plugin-fs = { version = "2.2.1" } +tauri-plugin-fs = { workspace = true } urlpattern = "0.3" regex = "1" http = "1" diff --git a/frontend/apps/editor3d/app/src/components/signaled/TopBar/TopBar.tsx b/frontend/apps/editor3d/app/src/components/signaled/TopBar/TopBar.tsx index ea520acbba..2ab2ca2ba6 100644 --- a/frontend/apps/editor3d/app/src/components/signaled/TopBar/TopBar.tsx +++ b/frontend/apps/editor3d/app/src/components/signaled/TopBar/TopBar.tsx @@ -167,14 +167,16 @@ export const TopBar = ({ pageName, loginSignUpPressed }: Props) => {