diff --git a/shell/float-window.ps1 b/shell/float-window.ps1 index 69b2f0f..822cf55 100644 --- a/shell/float-window.ps1 +++ b/shell/float-window.ps1 @@ -213,9 +213,16 @@ if (Test-Path $stateFile) { $script:state.fullscreen = $false } catch { Write-Warning "state file ignored: $($_.Exception.Message)" } } +# -NoExclude 只是本次运行的调试开关,不允许被写回状态文件(否则以后默认就不隐身了) +$script:persistExclude = [bool]$script:state.exclude function Save-State { - try { ($script:state | ConvertTo-Json -Depth 3) | Set-Content -Path $stateFile -Encoding UTF8 } catch {} + try { + $out = [ordered]@{} + foreach ($k in $script:state.Keys) { $out[$k] = $script:state[$k] } + if ($NoExclude) { $out.exclude = $script:persistExclude } + ($out | ConvertTo-Json -Depth 3) | Set-Content -Path $stateFile -Encoding UTF8 + } catch {} } # ---------------------------------------------------------------- 窗口