fix: build on linux and windows
This commit is contained in:
56
src-tauri/Cargo.lock
generated
56
src-tauri/Cargo.lock
generated
@@ -3482,9 +3482,9 @@ checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381"
|
||||
|
||||
[[package]]
|
||||
name = "open"
|
||||
version = "5.1.4"
|
||||
version = "5.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b5ca541f22b1c46d4bb9801014f234758ab4297e7870b904b6a8415b980a7388"
|
||||
checksum = "9d2c909a3fce3bd80efef4cd1c6c056bd9376a8fe06fcfdbebaf32cb485a7e37"
|
||||
dependencies = [
|
||||
"is-wsl",
|
||||
"libc",
|
||||
@@ -5390,8 +5390,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-clipboard-manager"
|
||||
version = "2.1.0-beta.4"
|
||||
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#955ed6aec6420d6a98337e2a3f33590d9d8fbdcf"
|
||||
version = "2.1.0-beta.5"
|
||||
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#8f6d341e45865c852170e8bbf2c8ffa9aca907d6"
|
||||
dependencies = [
|
||||
"arboard",
|
||||
"image 0.24.9",
|
||||
@@ -5421,8 +5421,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-dialog"
|
||||
version = "2.0.0-beta.9"
|
||||
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#955ed6aec6420d6a98337e2a3f33590d9d8fbdcf"
|
||||
version = "2.0.0-beta.10"
|
||||
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#8f6d341e45865c852170e8bbf2c8ffa9aca907d6"
|
||||
dependencies = [
|
||||
"dunce",
|
||||
"log",
|
||||
@@ -5438,8 +5438,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-fs"
|
||||
version = "2.0.0-beta.9"
|
||||
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#955ed6aec6420d6a98337e2a3f33590d9d8fbdcf"
|
||||
version = "2.0.0-beta.10"
|
||||
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#8f6d341e45865c852170e8bbf2c8ffa9aca907d6"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"glob",
|
||||
@@ -5456,8 +5456,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-http"
|
||||
version = "2.0.0-beta.10"
|
||||
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#955ed6aec6420d6a98337e2a3f33590d9d8fbdcf"
|
||||
version = "2.0.0-beta.11"
|
||||
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#8f6d341e45865c852170e8bbf2c8ffa9aca907d6"
|
||||
dependencies = [
|
||||
"data-url",
|
||||
"http",
|
||||
@@ -5476,8 +5476,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-notification"
|
||||
version = "2.0.0-beta.8"
|
||||
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#955ed6aec6420d6a98337e2a3f33590d9d8fbdcf"
|
||||
version = "2.0.0-beta.9"
|
||||
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#8f6d341e45865c852170e8bbf2c8ffa9aca907d6"
|
||||
dependencies = [
|
||||
"log",
|
||||
"notify-rust",
|
||||
@@ -5494,8 +5494,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-os"
|
||||
version = "2.0.0-beta.6"
|
||||
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#955ed6aec6420d6a98337e2a3f33590d9d8fbdcf"
|
||||
version = "2.0.0-beta.7"
|
||||
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#8f6d341e45865c852170e8bbf2c8ffa9aca907d6"
|
||||
dependencies = [
|
||||
"gethostname",
|
||||
"log",
|
||||
@@ -5511,8 +5511,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-process"
|
||||
version = "2.0.0-beta.6"
|
||||
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#955ed6aec6420d6a98337e2a3f33590d9d8fbdcf"
|
||||
version = "2.0.0-beta.7"
|
||||
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#8f6d341e45865c852170e8bbf2c8ffa9aca907d6"
|
||||
dependencies = [
|
||||
"tauri",
|
||||
"tauri-plugin",
|
||||
@@ -5520,8 +5520,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-shell"
|
||||
version = "2.0.0-beta.7"
|
||||
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#955ed6aec6420d6a98337e2a3f33590d9d8fbdcf"
|
||||
version = "2.0.0-beta.8"
|
||||
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#8f6d341e45865c852170e8bbf2c8ffa9aca907d6"
|
||||
dependencies = [
|
||||
"encoding_rs",
|
||||
"log",
|
||||
@@ -5558,8 +5558,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-updater"
|
||||
version = "2.0.0-beta.8"
|
||||
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#955ed6aec6420d6a98337e2a3f33590d9d8fbdcf"
|
||||
version = "2.0.0-beta.9"
|
||||
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#8f6d341e45865c852170e8bbf2c8ffa9aca907d6"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"dirs",
|
||||
@@ -5586,8 +5586,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-upload"
|
||||
version = "2.0.0-beta.7"
|
||||
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#955ed6aec6420d6a98337e2a3f33590d9d8fbdcf"
|
||||
version = "2.0.0-beta.8"
|
||||
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#8f6d341e45865c852170e8bbf2c8ffa9aca907d6"
|
||||
dependencies = [
|
||||
"futures-util",
|
||||
"log",
|
||||
@@ -5604,8 +5604,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-window-state"
|
||||
version = "2.0.0-beta.9"
|
||||
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#955ed6aec6420d6a98337e2a3f33590d9d8fbdcf"
|
||||
version = "2.0.0-beta.10"
|
||||
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#8f6d341e45865c852170e8bbf2c8ffa9aca907d6"
|
||||
dependencies = [
|
||||
"bitflags 2.6.0",
|
||||
"log",
|
||||
@@ -7237,18 +7237,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy"
|
||||
version = "0.7.34"
|
||||
version = "0.7.35"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087"
|
||||
checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0"
|
||||
dependencies = [
|
||||
"zerocopy-derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy-derive"
|
||||
version = "0.7.34"
|
||||
version = "0.7.35"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b"
|
||||
checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
||||
@@ -37,7 +37,7 @@ tauri-specta = { git = "https://github.com/reyamir/tauri-specta", features = [
|
||||
"typescript",
|
||||
] }
|
||||
tauri-plugin-theme = "0.4.1"
|
||||
tauri-plugin-decorum = "0.1.0"
|
||||
tauri-plugin-decorum = "0.1.3"
|
||||
specta = "^2.0.0-rc.12"
|
||||
keyring = "2"
|
||||
keyring-search = "0.2.0"
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#[cfg(target_os = "macos")]
|
||||
pub mod fns;
|
||||
#[cfg(target_os = "macos")]
|
||||
pub mod tray;
|
||||
pub mod window;
|
||||
|
||||
@@ -5,12 +5,15 @@ use std::str::FromStr;
|
||||
use cocoa::{appkit::NSApp, base::nil, foundation::NSString};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use specta::Type;
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
use tauri::utils::config::WindowEffectsConfig;
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
use tauri::window::Effect;
|
||||
#[cfg(target_os = "macos")]
|
||||
use tauri::TitleBarStyle;
|
||||
use tauri::WebviewWindowBuilder;
|
||||
use tauri::{LogicalPosition, LogicalSize, Manager, State, WebviewUrl};
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
use tauri_plugin_decorum::WebviewWindowExt;
|
||||
use url::Url;
|
||||
|
||||
@@ -187,26 +190,38 @@ pub fn open_window(window: Window, app_handle: tauri::AppHandle) -> Result<(), S
|
||||
.unwrap();
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
let window = WebviewWindowBuilder::new(&app_handle, label, WebviewUrl::App(PathBuf::from(url)))
|
||||
.title(title)
|
||||
.min_inner_size(width, height)
|
||||
.inner_size(width, height)
|
||||
.effects(WindowEffectsConfig {
|
||||
state: None,
|
||||
effects: vec![Effect::Mica],
|
||||
radius: None,
|
||||
color: None,
|
||||
})
|
||||
.build()
|
||||
.unwrap();
|
||||
let window = WebviewWindowBuilder::new(
|
||||
&app_handle,
|
||||
&window.label,
|
||||
WebviewUrl::App(PathBuf::from(window.url)),
|
||||
)
|
||||
.title(title)
|
||||
.min_inner_size(window.width, window.height)
|
||||
.inner_size(window.width, window.height)
|
||||
.minimizable(window.minimizable)
|
||||
.maximizable(window.maximizable)
|
||||
.effects(WindowEffectsConfig {
|
||||
state: None,
|
||||
effects: vec![Effect::Mica],
|
||||
radius: None,
|
||||
color: None,
|
||||
})
|
||||
.build()
|
||||
.unwrap();
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
let window = WebviewWindowBuilder::new(&app_handle, label, WebviewUrl::App(PathBuf::from(url)))
|
||||
.title(title)
|
||||
.min_inner_size(width, height)
|
||||
.inner_size(width, height)
|
||||
.build()
|
||||
.unwrap();
|
||||
let window = WebviewWindowBuilder::new(
|
||||
&app_handle,
|
||||
&window.label,
|
||||
WebviewUrl::App(PathBuf::from(window.url)),
|
||||
)
|
||||
.title(title)
|
||||
.min_inner_size(window.width, window.height)
|
||||
.inner_size(window.width, window.height)
|
||||
.minimizable(window.minimizable)
|
||||
.maximizable(window.maximizable)
|
||||
.build()
|
||||
.unwrap();
|
||||
|
||||
// Set decoration
|
||||
window.create_overlay_titlebar().unwrap();
|
||||
|
||||
@@ -20,6 +20,7 @@ use std::{
|
||||
str::FromStr,
|
||||
};
|
||||
use tauri::{path::BaseDirectory, Manager};
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
use tauri_plugin_decorum::WebviewWindowExt;
|
||||
|
||||
pub mod commands;
|
||||
@@ -139,6 +140,10 @@ fn main() {
|
||||
|
||||
tauri::Builder::default()
|
||||
.setup(|app| {
|
||||
#[cfg(target_os = "macos")]
|
||||
app.handle().plugin(tauri_nspanel::init()).unwrap();
|
||||
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
let main_window = app.get_webview_window("main").unwrap();
|
||||
|
||||
// Set custom decoration for Windows
|
||||
@@ -216,6 +221,21 @@ fn main() {
|
||||
|
||||
Ok(())
|
||||
})
|
||||
.enable_macos_default_menu(false)
|
||||
.on_window_event(move |window, event| {
|
||||
#[cfg(target_os = "macos")]
|
||||
if let tauri::WindowEvent::ThemeChanged(_) = event {
|
||||
if let Some(webview) = window.get_webview_window(window.label()) {
|
||||
webview.set_traffic_lights_inset(8.0, 16.0).unwrap();
|
||||
}
|
||||
}
|
||||
#[cfg(target_os = "macos")]
|
||||
if let tauri::WindowEvent::Resized(_) = event {
|
||||
if let Some(webview) = window.get_webview_window(window.label()) {
|
||||
webview.set_traffic_lights_inset(8.0, 16.0).unwrap();
|
||||
}
|
||||
}
|
||||
})
|
||||
.plugin(tauri_nspanel::init())
|
||||
.plugin(tauri_plugin_theme::init(ctx.config_mut()))
|
||||
.plugin(tauri_plugin_decorum::init())
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
{
|
||||
"$schema": "../node_modules/@tauri-apps/cli/schema.json",
|
||||
"app": {
|
||||
"windows": [
|
||||
{
|
||||
"title": "Lume",
|
||||
"label": "main",
|
||||
"titleBarStyle": "Overlay",
|
||||
"width": 500,
|
||||
"height": 800,
|
||||
"minWidth": 500,
|
||||
"minHeight": 800
|
||||
}
|
||||
]
|
||||
}
|
||||
"$schema": "../node_modules/@tauri-apps/cli/schema.json",
|
||||
"app": {
|
||||
"windows": [
|
||||
{
|
||||
"title": "Lume",
|
||||
"label": "main",
|
||||
"titleBarStyle": "Overlay",
|
||||
"width": 1045,
|
||||
"height": 800,
|
||||
"minWidth": 480,
|
||||
"minHeight": 760
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,21 @@
|
||||
{
|
||||
"$schema": "../node_modules/@tauri-apps/cli/schema.json",
|
||||
"app": {
|
||||
"windows": [
|
||||
{
|
||||
"title": "Lume",
|
||||
"label": "main",
|
||||
"width": 500,
|
||||
"height": 800,
|
||||
"minWidth": 500,
|
||||
"minHeight": 800,
|
||||
"transparent": true,
|
||||
"windowEffects": {
|
||||
"effects": ["mica"]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
"$schema": "../node_modules/@tauri-apps/cli/schema.json",
|
||||
"app": {
|
||||
"windows": [
|
||||
{
|
||||
"title": "Lume",
|
||||
"label": "main",
|
||||
"width": 1045,
|
||||
"height": 800,
|
||||
"minWidth": 480,
|
||||
"minHeight": 760,
|
||||
"transparent": true,
|
||||
"windowEffects": {
|
||||
"effects": [
|
||||
"mica"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user