feat: 自定义标题栏

This commit is contained in:
lanyeeee
2025-08-05 05:49:12 +08:00
parent 840776f3e3
commit 003c50ba13
13 changed files with 193 additions and 11 deletions
+50
View File
@@ -290,6 +290,7 @@ dependencies = [
"tauri",
"tauri-build",
"tauri-plugin-opener",
"tauri-plugin-os",
"tauri-specta",
"tokio",
"tracing",
@@ -1319,6 +1320,16 @@ dependencies = [
"version_check",
]
[[package]]
name = "gethostname"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc257fdb4038301ce4b9cd1b3b51704509692bb3ff716a410cbd07925d9dae55"
dependencies = [
"rustix",
"windows-targets 0.52.6",
]
[[package]]
name = "getrandom"
version = "0.1.16"
@@ -2697,6 +2708,18 @@ dependencies = [
"pin-project-lite",
]
[[package]]
name = "os_info"
version = "3.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0e1ac5fde8d43c34139135df8ea9ee9465394b2d8d20f032d38998f64afffc3"
dependencies = [
"log",
"plist",
"serde",
"windows-sys 0.52.0",
]
[[package]]
name = "overload"
version = "0.1.1"
@@ -4004,6 +4027,15 @@ dependencies = [
"syn 2.0.104",
]
[[package]]
name = "sys-locale"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8eab9a99a024a169fe8a903cf9d4a3b3601109bcc13bd9e3c6fff259138626c4"
dependencies = [
"libc",
]
[[package]]
name = "system-configuration"
version = "0.6.1"
@@ -4247,6 +4279,24 @@ dependencies = [
"zbus",
]
[[package]]
name = "tauri-plugin-os"
version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05bccb4c6de4299beec5a9b070878a01bce9e2c945aa7a75bcea38bcba4c675d"
dependencies = [
"gethostname",
"log",
"os_info",
"serde",
"serde_json",
"serialize-to-javascript",
"sys-locale",
"tauri",
"tauri-plugin",
"thiserror 2.0.12",
]
[[package]]
name = "tauri-runtime"
version = "2.7.0"
+1
View File
@@ -20,6 +20,7 @@ tauri-build = { version = "2", features = [] }
[dependencies]
tauri = { version = "2", features = [] }
tauri-plugin-opener = "2"
tauri-plugin-os = "2"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
+10 -3
View File
@@ -2,9 +2,16 @@
"$schema": "../gen/schemas/desktop-schema.json",
"identifier": "default",
"description": "Capability for the main window",
"windows": ["main"],
"windows": [
"main"
],
"permissions": [
"core:default",
"opener:default"
"opener:default",
"os:default",
"core:window:allow-start-dragging",
"core:window:allow-minimize",
"core:window:allow-toggle-maximize",
"core:window:allow-close"
]
}
}
+1
View File
@@ -75,6 +75,7 @@ pub fn run() {
.expect("Failed to export typescript bindings");
tauri::Builder::default()
.plugin(tauri_plugin_os::init())
.plugin(tauri_plugin_opener::init())
.invoke_handler(builder.invoke_handler())
.setup(move |app| {
-7
View File
@@ -10,13 +10,6 @@
"frontendDist": "../dist"
},
"app": {
"windows": [
{
"title": "bilibili-video-downloader",
"width": 800,
"height": 600
}
],
"security": {
"csp": null
}
+16
View File
@@ -0,0 +1,16 @@
{
"$schema": "https://schema.tauri.app/config/2",
"app": {
"windows": [
{
"title": "bilibili-video-downloader",
"width": 800,
"height": 600,
"minWidth": 800,
"minHeight": 600,
"decorations": false,
"theme": "Light"
}
]
}
}
+17
View File
@@ -0,0 +1,17 @@
{
"$schema": "https://schema.tauri.app/config/2",
"app": {
"windows": [
{
"title": "bilibili-video-downloader",
"width": 800,
"height": 600,
"minWidth": 800,
"minHeight": 600,
"hiddenTitle": true,
"titleBarStyle": "Overlay",
"theme": "Light"
}
]
}
}
+17
View File
@@ -0,0 +1,17 @@
{
"$schema": "https://schema.tauri.app/config/2",
"app": {
"windows": [
{
"title": "bilibili-video-downloader",
"width": 800,
"height": 600,
"minWidth": 800,
"minHeight": 600,
"decorations": false,
"shadow": true,
"theme": "Light"
}
]
}
}