diff --git a/docs/docs/config.mdx b/docs/docs/config.mdx index 05389e99ef..37e838127a 100644 --- a/docs/docs/config.mdx +++ b/docs/docs/config.mdx @@ -113,6 +113,7 @@ wsh editconfig | window:disablehardwareacceleration | bool | set to disable Chromium hardware acceleration to resolve graphical bugs (requires app restart) | | window:fullscreenonlaunch | bool | set to true to launch the foreground window in fullscreen mode (defaults to false) | | window:savelastwindow | bool | when `true`, the last window that is closed is preserved and is reopened the next time the app is launched (defaults to `true`) | +| window:restoreallwindows | bool | when `true`, all open windows (not just the last one) are preserved when closed and reopened the next time the app is launched, keeping their workspaces, tabs, and terminal working directories (defaults to `true`) | | window:confirmonclose | bool | when `true`, a prompt will ask a user to confirm that they want to close a window if it has an unsaved workspace with more than one tab (defaults to `true`) | | window:dimensions | string | set the default dimensions for new windows using the format "WIDTHxHEIGHT" (e.g. "1920x1080"). when a new window is created, these dimensions will be automatically applied. The width and height values should be specified in pixels. | | telemetry:enabled | bool | set to enable/disable telemetry | diff --git a/emain/emain-window.ts b/emain/emain-window.ts index e3bfa87751..a572f19148 100644 --- a/emain/emain-window.ts +++ b/emain/emain-window.ts @@ -308,7 +308,10 @@ export class WaveBrowserWindow extends BaseWindow { fireAndForget(async () => { const numWindows = waveWindowMap.size; const fullConfig = await RpcApi.GetFullConfigCommand(ElectronWshClient); - if (numWindows > 1 || !fullConfig.settings["window:savelastwindow"]) { + const preserveThisWindow = + fullConfig.settings["window:restoreallwindows"] || + (numWindows === 1 && fullConfig.settings["window:savelastwindow"]); + if (!preserveThisWindow) { if (fullConfig.settings["window:confirmclose"]) { const workspace = await WorkspaceService.GetWorkspace(this.workspaceId); if (isNonEmptyUnsavedWorkspace(workspace)) { diff --git a/frontend/types/gotypes.d.ts b/frontend/types/gotypes.d.ts index c5b870d7ed..235b90d951 100644 --- a/frontend/types/gotypes.d.ts +++ b/frontend/types/gotypes.d.ts @@ -1467,6 +1467,7 @@ declare global { "window:magnifiedblockblursecondarypx"?: number; "window:confirmclose"?: boolean; "window:savelastwindow"?: boolean; + "window:restoreallwindows"?: boolean; "window:dimensions"?: string; "window:zoom"?: number; "telemetry:*"?: boolean; diff --git a/pkg/wconfig/defaultconfig/settings.json b/pkg/wconfig/defaultconfig/settings.json index d8847cabf2..76e69b1a8d 100644 --- a/pkg/wconfig/defaultconfig/settings.json +++ b/pkg/wconfig/defaultconfig/settings.json @@ -29,6 +29,7 @@ "window:magnifiedblockblursecondarypx": 2, "window:confirmclose": true, "window:savelastwindow": true, + "window:restoreallwindows": true, "telemetry:enabled": true, "term:bellsound": false, "term:bellindicator": true, diff --git a/pkg/wconfig/metaconsts.go b/pkg/wconfig/metaconsts.go index 7d5bba5d9d..ad4d404ae2 100644 --- a/pkg/wconfig/metaconsts.go +++ b/pkg/wconfig/metaconsts.go @@ -110,6 +110,7 @@ const ( ConfigKey_WindowMagnifiedBlockBlurSecondaryPx = "window:magnifiedblockblursecondarypx" ConfigKey_WindowConfirmClose = "window:confirmclose" ConfigKey_WindowSaveLastWindow = "window:savelastwindow" + ConfigKey_WindowRestoreAllWindows = "window:restoreallwindows" ConfigKey_WindowDimensions = "window:dimensions" ConfigKey_WindowZoom = "window:zoom" diff --git a/pkg/wconfig/settingsconfig.go b/pkg/wconfig/settingsconfig.go index 67118b1670..0ce81b6caa 100644 --- a/pkg/wconfig/settingsconfig.go +++ b/pkg/wconfig/settingsconfig.go @@ -161,6 +161,7 @@ type SettingsType struct { WindowMagnifiedBlockBlurSecondaryPx *int64 `json:"window:magnifiedblockblursecondarypx,omitempty"` WindowConfirmClose bool `json:"window:confirmclose,omitempty"` WindowSaveLastWindow bool `json:"window:savelastwindow,omitempty"` + WindowRestoreAllWindows bool `json:"window:restoreallwindows,omitempty"` WindowDimensions string `json:"window:dimensions,omitempty"` WindowZoom *float64 `json:"window:zoom,omitempty"` diff --git a/schema/settings.json b/schema/settings.json index f341a0f365..360dd65871 100644 --- a/schema/settings.json +++ b/schema/settings.json @@ -301,6 +301,9 @@ "window:savelastwindow": { "type": "boolean" }, + "window:restoreallwindows": { + "type": "boolean" + }, "window:dimensions": { "type": "string" },