You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#7440 sets the window.openFoldersInNewWindow default value to inherit instead of default, so that new windows opened will inherit the window size and layout from the last active Positron window. This sort of behaviour has been sought out in #3303 and #6277.
The previous default was to center the new window on screen with a default size, which resulted in:
a lot of us feel like we resize and reposition every single new window
the layout of the new window (especially the panes) are too small and have to be readjusted every time
Before #7440, a few internal users were setting window.openFoldersInNewWindow to inherit and have seen significant improvement in the new window experience, especially for those who tend to use Positron in full-screen mode or in maximized windows.
current state
Once #7440 is merged, we arrive at improved default behaviour as long as the user's last active window has a reasonable size/layout. Users can change their configuration for window.openFoldersInNewWindow back to default or to another available option if they do not prefer this new default.
the remaining gap
Still, the window and pane sizes are something that users may find themselves fiddling with regularly, especially on a workspace/project-specific level.
To some extent, the window size, positioning on screen and layout is persisted and restored when closing and reopening the same project, but there is some inconsistency.
If Positron is exited altogether and reopened, it persists the windows/layouts/positioning, but closing/reopening workspaces/projects without quitting Positron altogether has some inconsistent behaviour in restoring the window to the right size/layout/position.
Desired behaviour: when not using full-screen/maximized Positron windows, when a workspace window is closed and reopened, the window should appear on the screen in the same position, with the same size and layout, as the workspace window at the time it was last closed.
example
closing_reopening_windows.mp4
repro steps
open workspaceA and position it on the left half of the screen
open workspaceB and position it on the right half of the screen
close workspaceA -- focus should shift to workspaceB
reopen workspaceA -- expect it to open on the left half of the screen, but it may not do this
what might be going on
When Positron is exited completely (shutdown), just before shutdown, we save the state in the state service.
The state is loaded the next time Positron is started up, and the size/layout/position of the windows restore as expected.
When a window is closed in Positron (the Positron app is still running, even if all windows have been closed), just before close, we update the in-memory state for the window to the current window state (size, position, etc.)
From debugging, it looks like that state is updated as expected, but the window size/layout/position looks to be restoring to the previously saved state from a previous shutdown of Positron.
In particular, I'd expect the window state to be loaded here, but stateForFolder is empty.
It's possible we need to be storing things a bit differently in the onBeforeClose scenario to get the desired behaviour. Note that the window state/restoration code is a bit hairy, as the events are fired in a different order depending on the OS.
Investigate why exactly the window state is being reloaded differently when windows are closed and reopened while Positron has not been shutdown.
Determine if there is a bug with the window restoration, or if we need to implement a new option to support such a workflow, possibly a new option for window.openFoldersInNewWindow (something like remember, which uses the last window size/layout/position for the workspace if known, otherwise falls back to inherit behaviour?)
background
#7440 sets the
window.openFoldersInNewWindowdefault value toinheritinstead ofdefault, so that new windows opened will inherit the window size and layout from the last active Positron window. This sort of behaviour has been sought out in #3303 and #6277.The previous default was to center the new window on screen with a default size, which resulted in:
Before #7440, a few internal users were setting
window.openFoldersInNewWindowtoinheritand have seen significant improvement in the new window experience, especially for those who tend to use Positron in full-screen mode or in maximized windows.current state
Once #7440 is merged, we arrive at improved default behaviour as long as the user's last active window has a reasonable size/layout. Users can change their configuration for
window.openFoldersInNewWindowback todefaultor to another available option if they do not prefer this new default.the remaining gap
Still, the window and pane sizes are something that users may find themselves fiddling with regularly, especially on a workspace/project-specific level.
To some extent, the window size, positioning on screen and layout is persisted and restored when closing and reopening the same project, but there is some inconsistency.
If Positron is exited altogether and reopened, it persists the windows/layouts/positioning, but closing/reopening workspaces/projects without quitting Positron altogether has some inconsistent behaviour in restoring the window to the right size/layout/position.
Desired behaviour: when not using full-screen/maximized Positron windows, when a workspace window is closed and reopened, the window should appear on the screen in the same position, with the same size and layout, as the workspace window at the time it was last closed.
example
closing_reopening_windows.mp4
repro steps
what might be going on
When Positron is exited completely (shutdown), just before shutdown, we save the state in the state service.
positron/src/vs/platform/windows/electron-main/windowsStateHandler.ts
Lines 217 to 219 in e8cf35a
The state is loaded the next time Positron is started up, and the size/layout/position of the windows restore as expected.
When a window is closed in Positron (the Positron app is still running, even if all windows have been closed), just before close, we update the in-memory state for the window to the current window state (size, position, etc.)
positron/src/vs/platform/windows/electron-main/windowsStateHandler.ts
Lines 240 to 247 in e8cf35a
From debugging, it looks like that state is updated as expected, but the window size/layout/position looks to be restoring to the previously saved state from a previous shutdown of Positron.
In particular, I'd expect the window state to be loaded here, but
stateForFolderis empty.positron/src/vs/platform/windows/electron-main/windowsStateHandler.ts
Lines 316 to 322 in 4849028
It's possible we need to be storing things a bit differently in the
onBeforeClosescenario to get the desired behaviour. Note that the window state/restoration code is a bit hairy, as the events are fired in a different order depending on the OS.positron/src/vs/platform/windows/electron-main/windowsStateHandler.ts
Lines 105 to 141 in e8cf35a
next steps
window.openFoldersInNewWindow(something likeremember, which uses the last window size/layout/position for the workspace if known, otherwise falls back toinheritbehaviour?)