feat: add window-state management and recovery functionality (#3792)
* feat: add window-state management and recovery functionality * fix: correct file name reference for window-state.json in uninstall section * fix: remove unused tauri_plugin_window_state import
This commit is contained in:
@@ -7,6 +7,10 @@
|
|||||||
- 修复 macOS Intel X86 架构构建错误导致无法运行
|
- 修复 macOS Intel X86 架构构建错误导致无法运行
|
||||||
- 修复 Linux 下界面边框白边问题
|
- 修复 Linux 下界面边框白边问题
|
||||||
|
|
||||||
|
### ✨ 新增功能
|
||||||
|
|
||||||
|
- 新增 window-state 窗口状态管理和恢复
|
||||||
|
|
||||||
## v2.3.0
|
## v2.3.0
|
||||||
|
|
||||||
**发行代号:御**
|
**发行代号:御**
|
||||||
|
|||||||
@@ -916,9 +916,9 @@ FunctionEnd
|
|||||||
!macroend
|
!macroend
|
||||||
|
|
||||||
Section Uninstall
|
Section Uninstall
|
||||||
;删除 .window-state.json 文件
|
;删除 window-state.json 文件
|
||||||
SetShellVarContext current
|
SetShellVarContext current
|
||||||
Delete "$APPDATA\io.github.clash-verge-rev.clash-verge-rev\.window-state.json"
|
Delete "$APPDATA\io.github.clash-verge-rev.clash-verge-rev\window-state.json"
|
||||||
|
|
||||||
!insertmacro CheckIfAppIsRunning
|
!insertmacro CheckIfAppIsRunning
|
||||||
!insertmacro CheckAllVergeProcesses
|
!insertmacro CheckAllVergeProcesses
|
||||||
@@ -1015,9 +1015,9 @@ Section Uninstall
|
|||||||
RmDir /r "$LOCALAPPDATA\${BUNDLEID}"
|
RmDir /r "$LOCALAPPDATA\${BUNDLEID}"
|
||||||
${EndIf}
|
${EndIf}
|
||||||
|
|
||||||
;删除 .window-state.json 文件
|
;删除 window-state.json 文件
|
||||||
SetShellVarContext current
|
SetShellVarContext current
|
||||||
Delete "$APPDATA\io.github.clash-verge-rev.clash-verge-rev\.window-state.json"
|
Delete "$APPDATA\io.github.clash-verge-rev.clash-verge-rev\window-state.json"
|
||||||
|
|
||||||
${GetOptions} $CMDLINE "/P" $R0
|
${GetOptions} $CMDLINE "/P" $R0
|
||||||
IfErrors +2 0
|
IfErrors +2 0
|
||||||
|
|||||||
@@ -162,6 +162,14 @@ pub fn run() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 窗口管理
|
||||||
|
logging!(info, Type::Setup, true, "初始化窗口状态管理...");
|
||||||
|
let window_state_plugin = tauri_plugin_window_state::Builder::new()
|
||||||
|
.with_filename("window_state.json")
|
||||||
|
.with_state_flags(tauri_plugin_window_state::StateFlags::default())
|
||||||
|
.build();
|
||||||
|
let _ = app.handle().plugin(window_state_plugin);
|
||||||
|
|
||||||
// 异步处理
|
// 异步处理
|
||||||
let app_handle = app.handle().clone();
|
let app_handle = app.handle().clone();
|
||||||
AsyncHandler::spawn(move || async move {
|
AsyncHandler::spawn(move || async move {
|
||||||
|
|||||||
Reference in New Issue
Block a user