New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement InitialPosition and CenterOnLaunch in the SUI #13605
Conversation
This comment has been minimized.
This comment has been minimized.
This comment was marked as outdated.
This comment was marked as outdated.
Should we put Center on Launch inside the expander for position? it's categorically related |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Design Questions/Topics
- Do we want to add a toggle switch to x/y-pos labeled something like "Use system default", and when it's enabled, we disable the x/y-pos?
- My concern is that the "Undefined" (or NaN value) isn't discoverable. I assume most people would want to keep this as "Use system default".
- Ideally, we would have a better UI than just putting the number in. I envisioned something like using your cursor as a crosshair to pick the position on a monitor, or pick the monitor itself. Then, that position gets converted to the InitialPosition in the settings UI. That said, that requires a lot more design and work. If we're not going down that path (or at least a path that's more user friendly), I suggest we file a work-item and throw it in the backlog to track this work.
- Building on that, maybe we want to expose this completely differently without the complex control above. Consider this...
- a ComboBox with...
- "Let windows decide" or "Use system default"
- "On a monitor"
- when selected, we show a NumberBox for "Monitor ID" that refers to the same monitor as that of Settings app > System > Display (hmm, this part might be hard, ugh)
- we could probably just use this this as an alias for "center on launch" too?
- "Custom position in pixels"
- show the two number pickers for x and y
- The main thing missing here is just the case where "fullscreen"/"maximized" mode have you pick the monitor. :/. Maybe we make it so that if you change the launch mode to either of those values, we update this control to be "on a monitor"?
- a ComboBox with...
Corner cases
- What happens if the user puts in (via SUI)...
- invalid input --> do we change to "Undefined"?
- a decimal number --> do we store it as an int in the settings model, but (more importantly) show it as a decimal or int in the SUI?
// put the placeholder text in the box instead | ||
if (auto xCoord{ x.try_as<int64_t>() }) | ||
{ | ||
return xCoord.has_value() ? gsl::narrow_cast<double>(xCoord.value()) : NAN; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
urgh. Do we have to worry about the data getting corrupted with this narrow_cast
? Like, if the JSON has a really big int
that couldn't fit in the double
?
src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw
Outdated
Show resolved
Hide resolved
src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw
Outdated
Show resolved
Hide resolved
Consensus from discussion:
Follow up in a future PR:
|
(Given the consensus opinion, How do you propose to have "centered focus mode" as a launch mode in the drop-down?) |
Okay fine, we need "Centered focus mode" in there too. But "Centered Maximized*" seemed viable to leave out. Technically yea you can have it launch centered (and maximize itself), and then restore down to centered. This design occludes that particular combination of settings for presenting the user something more sensible. If we're dead set on including that as a separate toggle, I'd instead propose: A set of controls under the Launch Positioning expander.
Heck, it doesn't even need to be one expando then. Could be three:
Maybe we hoped on the "add center to the dropdown" crazy idea train too fast. <discuss more> |
…/pabhoj/dxd_sui
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work! I all of these are small changes.
src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw
Outdated
Show resolved
Hide resolved
src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw
Outdated
Show resolved
Hide resolved
src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw
Outdated
Show resolved
Hide resolved
src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw
Outdated
Show resolved
Hide resolved
<comment>Header for a set of settings that determine how terminal launches.</comment> | ||
</data> | ||
<data name="Globals_LaunchParameters.HelpText" xml:space="preserve"> | ||
<value>Settings that control how the terminal launches</value> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<value>Settings that control how the terminal launches</value> | |
<value>Settings that control where the terminal launches</value> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is no longer just 'where' though, this expander now also contains LaunchMode
Hello @PankajBhojwani! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Post-hoc
|
||
if (UseDefaultLaunchPosition()) | ||
{ | ||
result = fmt::format(L"{}, {}, {}", launchModeString, RS_(L"Globals_LaunchModeDefault/Content"), centerOnLaunchString); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would have structured it a bit differently.
It would say:
Maximized, Default Position
Normal, Default Position, Centered
Minimized, (3, 3)
Focus, (4, 100), Centered
That way, we wouldn't include the less-meaningful strings "on" and "off" and we would only show contextually-appropriate data.
|
||
if (UseDefaultLaunchPosition()) | ||
{ | ||
result = fmt::format(L"{}, {}, {}", launchModeString, RS_(L"Globals_LaunchModeDefault/Content"), centerOnLaunchString); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(That is: replace off
with nothing, and on
with Centered
)
{ | ||
InitialPosX(NAN); | ||
InitialPosY(NAN); | ||
_NotifyChanges(L"InitialPosX", L"InitialPosY"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will generate up to three notifications for LaunchParametersCurrentValue
, right? Because it will cascade through the InitialPos#
setters as well.
🎉 Handy links: |
Summary of the Pull Request
InitialPosition
andCenterOnLaunch
can now be edited in the SUIPR Checklist
Detailed Description of the Pull Request / Additional comments
InitialPosition
follows the same style asLaunchSize
, with a number box for the x coordinate and a number box for the y coordinate. When there is no value for either of these coordinates, the respective number box is empty (and displays the textUndefined
).Validation Steps Performed
They work