mirror of
https://github.com/clash-verge-rev/clash-verge-rev
synced 2025-05-05 05:13:44 +08:00
feat: manage windows with tauri window-state to address various window issues
This commit is contained in:
parent
4ce376f830
commit
9d2dfe8d2f
@ -12,6 +12,12 @@
|
|||||||
- 解锁测试报错信息
|
- 解锁测试报错信息
|
||||||
- Macos 快捷键关闭窗口无法启用自动轻量模式
|
- Macos 快捷键关闭窗口无法启用自动轻量模式
|
||||||
- 静默启动异常窗口创建和关闭流程
|
- 静默启动异常窗口创建和关闭流程
|
||||||
|
- 使用 tauri window-state 管理窗口,尝试解决各种窗口异常
|
||||||
|
|
||||||
|
#### 新增了:
|
||||||
|
- 外部控制的开关
|
||||||
|
- 使用 socks 进行内核通信,以解决各种潜在的内核通信异常
|
||||||
|
|
||||||
|
|
||||||
## v2.2.3
|
## v2.2.3
|
||||||
|
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
"@tauri-apps/plugin-process": "^2.2.0",
|
"@tauri-apps/plugin-process": "^2.2.0",
|
||||||
"@tauri-apps/plugin-shell": "2.2.0",
|
"@tauri-apps/plugin-shell": "2.2.0",
|
||||||
"@tauri-apps/plugin-updater": "2.3.0",
|
"@tauri-apps/plugin-updater": "2.3.0",
|
||||||
|
"@tauri-apps/plugin-window-state": "^2.4.0",
|
||||||
"@types/d3-shape": "^3.1.7",
|
"@types/d3-shape": "^3.1.7",
|
||||||
"@types/json-schema": "^7.0.15",
|
"@types/json-schema": "^7.0.15",
|
||||||
"ahooks": "^3.8.4",
|
"ahooks": "^3.8.4",
|
||||||
|
16
src-tauri/Cargo.lock
generated
16
src-tauri/Cargo.lock
generated
@ -1092,6 +1092,7 @@ dependencies = [
|
|||||||
"tauri-plugin-process",
|
"tauri-plugin-process",
|
||||||
"tauri-plugin-shell",
|
"tauri-plugin-shell",
|
||||||
"tauri-plugin-updater",
|
"tauri-plugin-updater",
|
||||||
|
"tauri-plugin-window-state",
|
||||||
"tempfile",
|
"tempfile",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-tungstenite 0.26.2",
|
"tokio-tungstenite 0.26.2",
|
||||||
@ -7130,6 +7131,21 @@ dependencies = [
|
|||||||
"zip",
|
"zip",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tauri-plugin-window-state"
|
||||||
|
version = "2.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a27a3fe49de72adbe0d84aee33c89a0b059722cd0b42aaeab29eaaee7f7535cd"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.9.0",
|
||||||
|
"log",
|
||||||
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
"tauri",
|
||||||
|
"tauri-plugin",
|
||||||
|
"thiserror 2.0.12",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tauri-runtime"
|
name = "tauri-runtime"
|
||||||
version = "2.5.0"
|
version = "2.5.0"
|
||||||
|
@ -61,6 +61,7 @@ tauri-plugin-process = "2.2.0"
|
|||||||
tauri-plugin-clipboard-manager = "2.2.2"
|
tauri-plugin-clipboard-manager = "2.2.2"
|
||||||
tauri-plugin-deep-link = "2.2.0"
|
tauri-plugin-deep-link = "2.2.0"
|
||||||
tauri-plugin-devtools = "2.0.0"
|
tauri-plugin-devtools = "2.0.0"
|
||||||
|
tauri-plugin-window-state = "2.2.2"
|
||||||
zip = "2.5.0"
|
zip = "2.5.0"
|
||||||
reqwest_dav = "0.1.15"
|
reqwest_dav = "0.1.15"
|
||||||
aes-gcm = { version = "0.10.3", features = ["std"] }
|
aes-gcm = { version = "0.10.3", features = ["std"] }
|
||||||
|
@ -20,6 +20,7 @@ use tauri::Manager;
|
|||||||
use tauri_plugin_autostart::MacosLauncher;
|
use tauri_plugin_autostart::MacosLauncher;
|
||||||
use tauri_plugin_deep_link::DeepLinkExt;
|
use tauri_plugin_deep_link::DeepLinkExt;
|
||||||
use utils::logging::Type;
|
use utils::logging::Type;
|
||||||
|
use tauri_plugin_window_state;
|
||||||
|
|
||||||
/// A global singleton handle to the application.
|
/// A global singleton handle to the application.
|
||||||
pub struct AppHandleManager {
|
pub struct AppHandleManager {
|
||||||
@ -117,6 +118,9 @@ pub fn run() {
|
|||||||
.plugin(tauri_plugin_dialog::init())
|
.plugin(tauri_plugin_dialog::init())
|
||||||
.plugin(tauri_plugin_shell::init())
|
.plugin(tauri_plugin_shell::init())
|
||||||
.plugin(tauri_plugin_deep_link::init())
|
.plugin(tauri_plugin_deep_link::init())
|
||||||
|
.plugin(tauri_plugin_window_state::Builder::default()
|
||||||
|
.with_state_flags(tauri_plugin_window_state::StateFlags::all())
|
||||||
|
.build())
|
||||||
.setup(|app| {
|
.setup(|app| {
|
||||||
#[cfg(any(target_os = "linux", all(debug_assertions, windows)))]
|
#[cfg(any(target_os = "linux", all(debug_assertions, windows)))]
|
||||||
{
|
{
|
||||||
|
@ -163,13 +163,14 @@ pub fn create_window(is_showup: bool) {
|
|||||||
tauri::WebviewUrl::App("index.html".into()),
|
tauri::WebviewUrl::App("index.html".into()),
|
||||||
)
|
)
|
||||||
.title("Clash Verge")
|
.title("Clash Verge")
|
||||||
.inner_size(890.0, 700.0)
|
.inner_size(900.0, 700.0)
|
||||||
.min_inner_size(620.0, 550.0)
|
.min_inner_size(650.0, 580.0)
|
||||||
.decorations(false)
|
.decorations(false)
|
||||||
.maximizable(true)
|
.maximizable(true)
|
||||||
.additional_browser_args("--enable-features=msWebView2EnableDraggableRegions --disable-features=OverscrollHistoryNavigation,msExperimentalScrolling")
|
.additional_browser_args("--enable-features=msWebView2EnableDraggableRegions --disable-features=OverscrollHistoryNavigation,msExperimentalScrolling")
|
||||||
.transparent(true)
|
.transparent(true)
|
||||||
.shadow(true)
|
.shadow(true)
|
||||||
|
.visible(true)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
@ -181,8 +182,9 @@ pub fn create_window(is_showup: bool) {
|
|||||||
.decorations(true)
|
.decorations(true)
|
||||||
.hidden_title(true)
|
.hidden_title(true)
|
||||||
.title_bar_style(tauri::TitleBarStyle::Overlay)
|
.title_bar_style(tauri::TitleBarStyle::Overlay)
|
||||||
.inner_size(890.0, 700.0)
|
.inner_size(900.0, 700.0)
|
||||||
.min_inner_size(620.0, 550.0)
|
.min_inner_size(650.0, 580.0)
|
||||||
|
.visible(true)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
@ -193,17 +195,15 @@ pub fn create_window(is_showup: bool) {
|
|||||||
)
|
)
|
||||||
.title("Clash Verge")
|
.title("Clash Verge")
|
||||||
.decorations(false)
|
.decorations(false)
|
||||||
.inner_size(890.0, 700.0)
|
.inner_size(900.0, 700.0)
|
||||||
.min_inner_size(620.0, 550.0)
|
.min_inner_size(650.0, 580.0)
|
||||||
.transparent(true)
|
.transparent(true)
|
||||||
|
.visible(true)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
match window {
|
match window {
|
||||||
Ok(window) => {
|
Ok(_) => {
|
||||||
logging!(info, Type::Window, true, "Window created successfully");
|
logging!(info, Type::Window, true, "Window created successfully");
|
||||||
let _ = window.show();
|
|
||||||
let _ = window.set_focus();
|
|
||||||
|
|
||||||
// 标记前端UI已准备就绪,向前端发送启动完成事件
|
// 标记前端UI已准备就绪,向前端发送启动完成事件
|
||||||
let app_handle_clone = app_handle.clone();
|
let app_handle_clone = app_handle.clone();
|
||||||
AsyncHandler::spawn(move || async move {
|
AsyncHandler::spawn(move || async move {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user