commit e68e2097d59bd16649942f8860ed2c155394e5a4
parent 5faf40439da7e5f4005f4661ebdd78075276b1ab
Author: Greg Stoll <gstoll@mozilla.com>
Date: Sat, 25 Oct 2025 01:36:07 +0000
Bug 1995597 - add pref to disable restoring windows to their virtual desktop/workspace r=sessionstore-reviewers,sthompson
This is per a user request.
Differential Revision: https://phabricator.services.mozilla.com/D269641
Diffstat:
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/browser/components/sessionstore/SessionStore.sys.mjs b/browser/components/sessionstore/SessionStore.sys.mjs
@@ -202,6 +202,12 @@ ChromeUtils.defineLazyGetter(lazy, "blankURI", () => {
return Services.io.newURI("about:blank");
});
+XPCOMUtils.defineLazyPreferenceGetter(
+ lazy,
+ "gRestoreWindowsToVirtualDesktop",
+ "browser.sessionstore.restore_windows_to_virtual_desktop"
+);
+
/**
* |true| if we are in debug mode, |false| otherwise.
* Debug mode is controlled by preference browser.sessionstore.debug
@@ -5737,7 +5743,7 @@ var SessionStoreInternal = {
this._sendWindowRestoringNotification(aWindow);
this._setWindowStateBusy(aWindow);
- if (winData.workspaceID) {
+ if (winData.workspaceID && lazy.gRestoreWindowsToVirtualDesktop) {
this._log.debug(`Moving window to workspace: ${winData.workspaceID}`);
aWindow.moveToWorkspace(winData.workspaceID);
}
diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml
@@ -1917,6 +1917,13 @@
value: false
mirror: always
+# Whether to restore windows to the virtual desktop (aka workspace)
+# they were on when they were closed.
+- name: browser.sessionstore.restore_windows_to_virtual_desktop
+ type: RelaxedAtomicBool
+ value: true
+ mirror: always
+
# If set, when a link is opened to a new tab, do not switch to the new tab.
#
# This pref is used when the link is opened with "Open Link in New Tab",