initialPosition should set both coordinates when one number exists #5964

Closed
opened 2026-01-31 00:26:39 +00:00 by claunia · 5 comments
Owner

Originally created by @cinnamon-msft on GitHub (Jan 15, 2020).

Originally assigned to: @carlos-zamora, @cinnamon-msft on GitHub.

Environment

Windows build number: 10.0.19041.0
Windows Terminal version (if applicable): 0.8.10091.0

Any other software?

Steps to reproduce

Set initialPosition to "#" (any number will work).

Expected behavior

That number will set both the X and Y coordinates of the Terminal on launch. This matches the functionality of padding.

Actual behavior

Only the X coordinate gets set.

Originally created by @cinnamon-msft on GitHub (Jan 15, 2020). Originally assigned to: @carlos-zamora, @cinnamon-msft on GitHub. <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> <!-- This bug tracker is monitored by Windows Terminal development team and other technical folks. **Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**. Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue. If this is an application crash, please also provide a Feedback Hub submission link so we can find your diagnostic data on the backend. Use the category "Apps > Windows Terminal (Preview)" and choose "Share My Feedback" after submission to get the link. Please use this form and describe your issue, concisely but precisely, with as much detail as possible. --> # Environment ```none Windows build number: 10.0.19041.0 Windows Terminal version (if applicable): 0.8.10091.0 Any other software? ``` # Steps to reproduce Set `initialPosition` to "#" (any number will work). # Expected behavior That number will set both the X and Y coordinates of the Terminal on launch. This matches the functionality of `padding`. # Actual behavior Only the X coordinate gets set.
Author
Owner

@DHowett-MSFT commented on GitHub (Jan 16, 2020):

This'll be in contravention to the agreed-upon spec for launch position. We need consensus before changing it.

@DHowett-MSFT commented on GitHub (Jan 16, 2020): This'll be in contravention to the agreed-upon spec for launch position. We need consensus before changing it.
Author
Owner

@carlos-zamora commented on GitHub (May 12, 2020):

In a post-v1 world, I still see this as a bug and agree with @cinnamon-msft on the reasoning. Since I see it as a bug, I don't think we'd be "breaking" people.

I'll move this over to the v2 milestone for us to discuss and resolve. Especially since most of the work here is deciding on the right behavior, rather than actually implementing it.

@carlos-zamora commented on GitHub (May 12, 2020): In a post-v1 world, I still see this as a bug and agree with @cinnamon-msft on the reasoning. Since I see it as a bug, I don't think we'd be "breaking" people. I'll move this over to the v2 milestone for us to discuss and resolve. Especially since most of the work here is deciding on the right behavior, rather than actually implementing it.
Author
Owner

@vhanla commented on GitHub (Sep 3, 2020):

What about?

"initialPosition": "centered"

BTW, without this "optional" option it will show in a random position each time Windows Terminal is launched.
 

In normal launch: as you can see in the picture above, each new window instance will be positioned in cascade and eventually some instances will show the lower part of the window hidden by the taskbar, making that part invisible when user reaches that area while writing commands, and (normally) the user will be forced to move the window.

It would be nice to consider that and detect Taskbar position and state, to conveniently position the Windows Terminal window on each launch.

I guess SHAppBarMessage ABS_ALWAYSONTOP and ABS_QUERYPOS or ABS_GETTASKBARPOS will help. However for other instances of taskbar (if enabled for another secondary monitor), I couldn't get SHAppBarMessage to work so I used EnumWindows callback to findow Shell_SecondaryTrayWnd window classname (each other taskbar instance <2nd, 3rd, etc> has that class name), to finally use GetWindowRect to find their corresponding areas occupying their respective monitors along with MonitorFromWindow.

@vhanla commented on GitHub (Sep 3, 2020): What about? "initialPosition": "centered" BTW, without this "optional" option it will show in a random position each time Windows Terminal is launched.   ![](https://user-images.githubusercontent.com/1015823/92073215-cc706d80-ed78-11ea-8312-d1c9671a02b0.png) In normal launch: as you can see in the picture above, each new window instance will be positioned in cascade and eventually some instances will show the lower part of the window hidden by the taskbar, making that part invisible when user reaches that area while writing commands, and (normally) the user will be forced to move the window. **It would be nice to consider that and detect Taskbar position and state, to conveniently position the Windows Terminal window on each launch.** I guess [SHAppBarMessage](https://docs.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-shappbarmessage) ABS\_ALWAYSONTOP and ABS\_QUERYPOS or ABS\_GETTASKBARPOS will help. **However** for other instances of taskbar (if enabled for another **secondary monitor**), I couldn't get SHAppBarMessage to work so I used EnumWindows callback to findow `Shell_SecondaryTrayWnd` window classname (each other taskbar instance \<2nd, 3rd, etc> has that class name), to finally use [GetWindowRect](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getwindowrect) to find their corresponding areas occupying their respective monitors along with [MonitorFromWindow](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-monitorfromwindow).
Author
Owner

@KalleOlaviNiemitalo commented on GitHub (Sep 3, 2020):

Would it be better to use MONITORINFO::rcWork than enumerate taskbars? If this kind of thing is necessary in the first place.

@KalleOlaviNiemitalo commented on GitHub (Sep 3, 2020): Would it be better to use MONITORINFO::rcWork than enumerate taskbars? If this kind of thing is necessary in the first place.
Author
Owner

@marcelwgn commented on GitHub (Apr 9, 2024):

Is the idea of being able to provide a single number for both options still seen as "Help wanted" and can be implemented? If so, I would take my shot at this

@marcelwgn commented on GitHub (Apr 9, 2024): Is the idea of being able to provide a single number for both options still seen as "Help wanted" and can be implemented? If so, I would take my shot at this
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#5964