保存窗口的大小状态,优化成员列表显示,开机自启隐藏于托盘,服务器地址输入支持带协议 [protocol]://

This commit is contained in:
黑先森
2024-11-15 16:22:21 +08:00
parent 4bedec63ca
commit f0633761a0
9 changed files with 264 additions and 111 deletions
+17 -1
View File
@@ -1176,7 +1176,7 @@ checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125"
[[package]]
name = "easytier-game"
version = "1.2.0"
version = "1.2.1"
dependencies = [
"log",
"planif",
@@ -1192,6 +1192,7 @@ dependencies = [
"tauri-plugin-log",
"tauri-plugin-shell",
"tauri-plugin-single-instance",
"tauri-plugin-window-state",
"whoami",
"windows 0.58.0",
"zip",
@@ -4543,6 +4544,21 @@ dependencies = [
"zbus",
]
[[package]]
name = "tauri-plugin-window-state"
version = "2.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "683c8764751fbbcebf3a594bcee24cf84c62773fa0080d1b40fc80698472421e"
dependencies = [
"bitflags 2.6.0",
"log",
"serde",
"serde_json",
"tauri",
"tauri-plugin",
"thiserror 1.0.64",
]
[[package]]
name = "tauri-runtime"
version = "2.2.0"
+2 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "easytier-game"
version = "1.2.0"
version = "1.2.1"
homepage = "https://github.com/EasyTier/EasyTier"
repository = "https://github.com/EasyTier/EasytierGame"
description = "A simple network initiator based on Easytier"
@@ -50,3 +50,4 @@ features = ["Win32_System_TaskScheduler"]
[target."cfg(not(any(target_os = \"android\", target_os = \"ios\")))".dependencies]
tauri-plugin-autostart = "2.0.1"
tauri-plugin-single-instance = "2.0.1"
tauri-plugin-window-state = "2"
+3 -1
View File
@@ -88,6 +88,8 @@
"fs:allow-resource-write-recursive",
"clipboard-manager:allow-clear",
"clipboard-manager:allow-read-text",
"clipboard-manager:allow-write-text"
"clipboard-manager:allow-write-text",
"window-state:default"
]
}
+14 -8
View File
@@ -518,12 +518,17 @@ fn autostart(enabled: bool) -> std::result::Result<(), Box<dyn std::error::Error
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
// 获取命令行参数
let _args: Vec<String> = std::env::args().collect();
let args: Vec<String> = std::env::args().collect();
let stop_signal = Arc::new(AtomicBool::new(false)); // 创建一个原子布尔值,用于控制命令的停止
let stop_signal_clone = Arc::clone(&stop_signal); // 创建一个原子布尔值的克隆,用于传递给命令
let context = tauri::generate_context!();
tauri::Builder::default()
.plugin(
tauri_plugin_window_state::Builder::new()
.with_state_flags(tauri_plugin_window_state::StateFlags::SIZE)
.build(),
)
.plugin(tauri_plugin_clipboard_manager::init())
.plugin(tauri_plugin_fs::init())
.plugin(tauri_plugin_autostart::init(
@@ -539,7 +544,7 @@ pub fn run() {
.expect("failed to set focus");
}))
.setup(move |app| {
// let args = args.clone();
let args = args.clone();
if cfg!(debug_assertions) {
app.handle().plugin(
tauri_plugin_log::Builder::default()
@@ -566,12 +571,13 @@ pub fn run() {
))?)
.icon_as_template(false)
.build(app)?;
// 开机自启隐藏到托盘
// if args.contains(&String::from(TASKAUTOSTART_ARG)) {
// app.get_webview_window("main")
// .expect("no main window to hide")
// .hide()?;
// }
// 开机自启隐藏到托盘或者显示主窗口
if !args.contains(&String::from(TASKAUTOSTART_ARG)) {
let main_window = app.get_webview_window("main").unwrap();
main_window.show().expect("failed to show window");
main_window.set_focus().expect("failed to set focus");
}
Ok(())
})
+5 -2
View File
@@ -1,7 +1,7 @@
{
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
"productName": "easytier-game",
"version": "1.2.0",
"version": "1.2.1",
"identifier": "com.tauri.easytier-game",
"build": {
@@ -13,7 +13,9 @@
"app": {
"windows": [
{
"title": "easytier-game 1.2.0",
"title": "easytier-game 1.2.1",
"label": "main",
"url": "#/",
"minWidth": 340,
"width": 340,
"height": 305,
@@ -24,6 +26,7 @@
"fullscreen": false,
"decorations": true,
"center": true,
"visible": false,
"maximizable": false,
"transparent": false
}