update
This commit is contained in:
57
src-tauri/Cargo.lock
generated
57
src-tauri/Cargo.lock
generated
@@ -1003,7 +1003,7 @@ version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412"
|
||||
dependencies = [
|
||||
"libloading 0.7.4",
|
||||
"libloading 0.8.8",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1044,6 +1044,7 @@ dependencies = [
|
||||
"futures",
|
||||
"minifb",
|
||||
"ollama-rs",
|
||||
"rusqlite",
|
||||
"screenshots",
|
||||
"serde",
|
||||
"serde_json",
|
||||
@@ -1206,6 +1207,18 @@ dependencies = [
|
||||
"zune-inflate",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fallible-iterator"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649"
|
||||
|
||||
[[package]]
|
||||
name = "fallible-streaming-iterator"
|
||||
version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a"
|
||||
|
||||
[[package]]
|
||||
name = "fastrand"
|
||||
version = "2.3.0"
|
||||
@@ -1247,6 +1260,12 @@ version = "1.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
||||
|
||||
[[package]]
|
||||
name = "foldhash"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
|
||||
|
||||
[[package]]
|
||||
name = "foreign-types"
|
||||
version = "0.3.2"
|
||||
@@ -1747,6 +1766,18 @@ name = "hashbrown"
|
||||
version = "0.15.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5971ac85611da7067dbfcabef3c70ebb5606018acd9e2a3903a0da507521e0d5"
|
||||
dependencies = [
|
||||
"foldhash",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashlink"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1"
|
||||
dependencies = [
|
||||
"hashbrown 0.15.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
@@ -2389,6 +2420,16 @@ dependencies = [
|
||||
"redox_syscall",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libsqlite3-sys"
|
||||
version = "0.35.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "133c182a6a2c87864fe97778797e46c7e999672690dc9fa3ee8e241aa4a9c13f"
|
||||
dependencies = [
|
||||
"pkg-config",
|
||||
"vcpkg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libwayshot"
|
||||
version = "0.2.0"
|
||||
@@ -3753,6 +3794,20 @@ dependencies = [
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rusqlite"
|
||||
version = "0.37.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "165ca6e57b20e1351573e3729b958bc62f0e48025386970b6e4d29e7a7e71f3f"
|
||||
dependencies = [
|
||||
"bitflags 2.9.1",
|
||||
"fallible-iterator",
|
||||
"fallible-streaming-iterator",
|
||||
"hashlink",
|
||||
"libsqlite3-sys",
|
||||
"smallvec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc-demangle"
|
||||
version = "0.1.25"
|
||||
|
||||
@@ -19,7 +19,7 @@ tauri-build = { version = "2", features = [] }
|
||||
|
||||
[dependencies]
|
||||
ollama-rs = { version = "0.3.2", features = ["stream"] }
|
||||
tauri = { version = "2", features = [] }
|
||||
tauri = { version = "2", features = ["macos-private-api"] }
|
||||
tauri-plugin-opener = "2"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
@@ -30,6 +30,7 @@ screenshots = "0.8.10"
|
||||
minifb = "0.28.0"
|
||||
tesseract = "0.15.2"
|
||||
uuid = { version = "1.17.0", features = ["v4"] }
|
||||
rusqlite = "0.37.0"
|
||||
[target."cfg(target_os = \"macos\")".dependencies]
|
||||
cocoa = "0.26.1"
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
"windows": ["main"],
|
||||
"permissions": [
|
||||
"core:default",
|
||||
"opener:default"
|
||||
"opener:default",
|
||||
"core:webview:default",
|
||||
"core:webview:allow-create-webview-window"
|
||||
]
|
||||
}
|
||||
|
||||
32
src-tauri/src/commands/create_window.rs
Normal file
32
src-tauri/src/commands/create_window.rs
Normal file
@@ -0,0 +1,32 @@
|
||||
use tauri::{WebviewUrl, WebviewWindowBuilder, TitleBarStyle};
|
||||
|
||||
#[tauri::command]
|
||||
pub fn create_window(app: tauri::AppHandle, label: &str, title: &str, url: &str, width: f64, height: f64) {
|
||||
let win_builder = tauri::WebviewWindowBuilder::new(&app, label, WebviewUrl::App(url.into()))
|
||||
.title(title)
|
||||
.inner_size(width, height);
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
let win_builder = win_builder.title_bar_style(TitleBarStyle::Transparent);
|
||||
|
||||
let window = win_builder.build().unwrap();
|
||||
|
||||
// 仅在构建 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,
|
||||
255.0 / 255.0,
|
||||
255.0 / 255.0,
|
||||
255.0 / 255.0,
|
||||
1.0,
|
||||
);
|
||||
ns_window.setBackgroundColor_(bg_color);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
pub mod translate_steam;
|
||||
pub mod copy;
|
||||
pub mod screenshot;
|
||||
pub mod screenshot;
|
||||
pub mod create_window;
|
||||
@@ -1,4 +1,4 @@
|
||||
use tauri::{TitleBarStyle, WebviewUrl, WebviewWindowBuilder, Emitter};
|
||||
use tauri::{TitleBarStyle, WebviewUrl, WebviewWindowBuilder};
|
||||
|
||||
mod commands;
|
||||
|
||||
@@ -9,7 +9,7 @@ pub fn run() {
|
||||
let win_builder =
|
||||
WebviewWindowBuilder::new(app, "main", WebviewUrl::default())
|
||||
.title("Transparent Titlebar Window")
|
||||
.inner_size(700.0, 300.0);
|
||||
.inner_size(700.0, 320.0);
|
||||
|
||||
// 仅在 macOS 时设置透明标题栏
|
||||
#[cfg(target_os = "macos")]
|
||||
@@ -41,7 +41,8 @@ pub fn run() {
|
||||
.plugin(tauri_plugin_opener::init())
|
||||
.invoke_handler(tauri::generate_handler![
|
||||
commands::translate_steam::translate_steam,
|
||||
commands::copy::copy
|
||||
commands::copy::copy,
|
||||
commands::create_window::create_window
|
||||
])
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
"frontendDist": "../dist"
|
||||
},
|
||||
"app": {
|
||||
"macOSPrivateApi": true,
|
||||
"windows": [],
|
||||
"security": {
|
||||
"csp": null
|
||||
|
||||
Reference in New Issue
Block a user