Repository navigation
feat: restore windows to their original macOS Spaces on restart - #308301
Toru Nayuki (tnayuki) wants to merge 4 commits into
Conversation
Add electron-osx-spaces dependency to save and restore the Space (virtual desktop) each window belongs to. This uses AppKit's native NSWindow state restoration APIs via the electron-osx-spaces package. Fixes microsoft#123517
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: Benjamin Pasero (@bpasero)Matched files:
|
|
@microsoft-github-policy-service agree |
…estoration # Conflicts: # package.json
|
Looking forward to this! |
|
You are a hero to the people. 👏 Could you document what happens when different Spaces are closed or moved between app close and app restart? |
I'm not deeply across all the nuance of things in this space, but from some recent deep reading through related Chromium bug fixes / etc; I think the 'correct' Apple API's to use are actually
Specifically this comment:
I raised an upstream issue in |
|
Glenn 'devalias' Grant (@0xdevalias) Thanks for the research! Switching to |
|
Benjamin Pasero (@bpasero) can you evaluate the integration point In particular, it would help to know which concern is the principal blocker: the manual AppKit state-restoration mechanism; I would be happy to help coordinate testing across macOS versions, Apple Silicon/Intel, multiple monitors, update restarts, deleted or reordered Spaces, and external-monitor disconnection. A brief architectural direction would help contributors focus on the evidence or changes needed for an Insiders trial. |
Fixes #123517
Summary
electron-osx-spacesas a dependency to save and restore the macOS Space (virtual desktop) each window belongs toNSWindowstate restoration APIs (encodeRestorableStateWithCoder:/restoreStateWithCoder:) via theelectron-osx-spacespackageIWindowState.macOSRestorableStateChanges
package.jsonelectron-osx-spacesto dependencieswindow.tsmacOSRestorableStatefield toIWindowStatewindowImpl.tsHow to test
Cmd+Shift+N)Cmd+Q)Compatibility
macOSRestorableStateis optional; old state data works without itelectron-osx-spacesreturns no-op on non-macOS platformsNSWindowRestoresWorkspaceAtLaunchbeing broken (FB15644170)