Remember last window position and size #8085

Closed
opened 2026-01-31 01:20:23 +00:00 by claunia · 8 comments
Owner

Originally created by @mataski on GitHub (May 12, 2020).

Description of the new feature/enhancement

You have to drag it and reposition and resize every time on launch.

Originally created by @mataski on GitHub (May 12, 2020). # Description of the new feature/enhancement You have to drag it and reposition and resize every time on launch.
claunia added the Issue-FeatureResolution-Duplicate labels 2026-01-31 01:20:23 +00:00
Author
Owner

@zadjii-msft commented on GitHub (May 12, 2020):

Thanks for the suggestion! This is actually already being tracked by another issue on our repo - please refer to #766 for more discussion.

/dup #766

Also, if you like using the same window position every single time, might I interest you in the initialPosition setting? You can use that to position the window, and the initialCols/initialRows setting to control the launch size.

Property Necessity Type Default Description
initialCols Required Integer 120 The number of columns displayed in the window upon first load.
initialPosition Optional String "," The position of the top left corner of the window upon first load. On a system with multiple displays, these coordinates are relative to the top left of the primary display. If launchMode is set to "maximized", the window will be maximized on the monitor specified by those coordinates.
initialRows Required Integer 30 The number of rows displayed in the window upon first load.
launchMode Optional String default Defines whether the Terminal will launch as maximized or not. Possible values: "default", "maximized"
@zadjii-msft commented on GitHub (May 12, 2020): Thanks for the suggestion! This is actually already being tracked by another issue on our repo - please refer to #766 for more discussion. /dup #766 Also, if you like using the same window position every single time, might I interest you in the `initialPosition` setting? You can use that to position the window, and the `initialCols`/`initialRows` setting to control the launch size. Property | Necessity | Type | Default | Description -- | -- | -- | -- | -- initialCols | Required | Integer | 120 | The number of columns displayed in the window upon first load. initialPosition | Optional | String | "," | The position of the top left corner of the window upon first load. On a system with multiple displays, these coordinates are relative to the top left of the primary display. If launchMode is set to "maximized", the window will be maximized on the monitor specified by those coordinates. initialRows | Required | Integer | 30 | The number of rows displayed in the window upon first load. launchMode | Optional | String | default | Defines whether the Terminal will launch as maximized or not. Possible values: "default", "maximized"
Author
Owner

@ghost commented on GitHub (May 12, 2020):

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@ghost commented on GitHub (May 12, 2020): Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!
Author
Owner

@ghost commented on GitHub (May 18, 2021):

@zadjii-msft I don't see how this is a duplicate of 766. this issue describes wanting to have the window frame restored to it's last known position and size on launch, where 766 describes wanting to have the terminal app restore previously open profile tabs on launch...

I'm still only testing MS Terminal, using Hyper as my primary, mostly just because the terminal window opens in unexpected places, which (after using a keyboard shortcut to launch it) I still need to flip to my mouse, move the window, then flip back to my keyboard to continue.

This may be a trivial UI point, but it's one crazy UX killer...

@ghost commented on GitHub (May 18, 2021): @zadjii-msft I don't see how this is a duplicate of 766. *this* issue describes wanting to have the window frame restored to it's last known **position and size** on launch, where *766* describes wanting to have the terminal app restore previously open **profile tabs** on launch... I'm still only testing MS Terminal, using Hyper as my primary, **mostly** just because the terminal window opens in unexpected places, which (after using a keyboard shortcut to launch it) I still need to flip to my mouse, move the window, then flip back to my keyboard to continue. This may be a trivial **UI** point, but it's one crazy **UX** killer...
Author
Owner

@zadjii-msft commented on GitHub (May 18, 2021):

From #766

To clarify:

  • #766 (This issue) is tracking restoring the relative window state across terminal launches. This includes (but is not limited to) window positions, the open tab/pane structure, and what profiles were in those tab/panes. It is not tracking restoring buffer state.
  • #961 is specifically related to trying to restore the buffer content of these tabs/panes. This is substantially harder than just restoring the window state, because the buffer has quite a bit more state in it. It is not tracking connection state (commandline history, environment variables, open processes)
  • #960 is about just "restoring previously opened tabs/panes". This is like when you close a tab in a browser, then hit Ctrl+shift+t to just pop it back into existence. This does not include across reboots - it mainly deals with tab/panes closed in the current instance.
  • There's not an issue tracking restoring connection/shell/process state, because that's generally impossible. (case in point: #961 (comment), et. al in that thread.)
  • #9188 is "restoring the window state while it is running, but after an external monitor is disconnected and re-connected?"

(emp. added)

initialPosition can be used if you're always wanting the window in the same position.

alt+space, m, arrow keys can be used to move the window with the keyboard (if you really hate using the mouse).

@zadjii-msft commented on GitHub (May 18, 2021): From #766 > To clarify: > > * #766 (This issue) is tracking restoring the relative window state across terminal launches. This includes (but is not limited to) **window positions**, the open tab/pane structure, and what profiles were in those tab/panes. It is _not_ tracking restoring buffer state. > * #961 is specifically related to trying to restore the _buffer_ content of these tabs/panes. This is substantially harder than just restoring the window state, because the buffer has quite a bit more state in it. It is _not_ tracking connection state (commandline history, environment variables, open processes) > * #960 is about just "restoring previously opened tabs/panes". This is like when you close a tab in a browser, then hit Ctrl+shift+t to just pop it back into existence. This does not include across reboots - it mainly deals with tab/panes closed in the current instance. > * There's not an issue tracking restoring connection/shell/process state, because that's _generally impossible_. (case in point: [#961 (comment)](https://github.com/microsoft/terminal/issues/961#issuecomment-495506932), et. al in that thread.) > * #9188 is "restoring the window state while it is running, but after an external monitor is disconnected and re-connected?" (emp. added) `initialPosition` can be used if you're always wanting the window in the _same_ position. <kbd>alt+space</kbd>, <kbd>m</kbd>, <kbd>arrow keys</kbd> can be used to move the window with the keyboard (if you really hate using the mouse).
Author
Owner

@ghost commented on GitHub (May 18, 2021):

Ah, it seems that this goes much deeper than my issue search revealed earlier.. Apologies for jumping to conclusions, but also thank you for the clarification.

I do still have some strange behaviour regarding the window positioning that feel like issues to be fixed, so I'll go digging through other issue logs and comments later when I have a bit more time. 👍🏼

@ghost commented on GitHub (May 18, 2021): Ah, it seems that this goes much deeper than my issue search revealed earlier.. Apologies for jumping to conclusions, but also thank you for the clarification. I do still have some strange behaviour regarding the window positioning that *feel* like issues to be fixed, so I'll go digging through other issue logs and comments later when I have a bit more time. 👍🏼
Author
Owner

@iVapor commented on GitHub (Apr 25, 2023):

Search a lot. Just add initialPosition in your settings.json.
"initialPosition": "2400,500", // x,y

@iVapor commented on GitHub (Apr 25, 2023): Search a lot. Just add initialPosition in your settings.json. "initialPosition": "2400,500", // x,y
Author
Owner

@isimmons commented on GitHub (Jul 21, 2023):

So if all I want is to remember size and position like ever other application but not restore old sessions (tabs, CWD, history, etc.) I just do the following?

Go into settings.json, add the missing initialPosition setting, tinker and adjust multiple times, restarting terminal until you finally get the position right. Now change initialCol and initialRow size because top/left position is correct but bottom/left is off the screen. Now since changing initialCol and initialRow actually affected the top/left position instead of expected bottom/right, go back and tinker/adjust the position multiple times again until it is correct. Possibly need to readjust the col and row again. Keep repeating the whole process until the window size and position is where you want it. Then repeat on another PC with a different screen size and resolution. Make a backup copy of settings.json (for each PC) so you don't have to go through this process again.

Is that right?

Sounds easy enough

@isimmons commented on GitHub (Jul 21, 2023): So if all I want is to remember size and position like ever other application but not restore old sessions (tabs, CWD, history, etc.) I just do the following? Go into settings.json, add the missing initialPosition setting, tinker and adjust multiple times, restarting terminal until you finally get the position right. Now change initialCol and initialRow size because top/left position is correct but bottom/left is off the screen. Now since changing initialCol and initialRow actually affected the top/left position instead of expected bottom/right, go back and tinker/adjust the position multiple times again until it is correct. Possibly need to readjust the col and row again. Keep repeating the whole process until the window size and position is where you want it. Then repeat on another PC with a different screen size and resolution. Make a backup copy of settings.json (for each PC) so you don't have to go through this process again. Is that right? Sounds easy enough
Author
Owner

@DHowett commented on GitHub (Jul 21, 2023):

Yup, that's right!

@DHowett commented on GitHub (Jul 21, 2023): Yup, that's right!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#8085