Skip to content
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

7124: Add focus and maximizedFocus launch modes #7873

Merged
10 commits merged into from
Oct 14, 2020

Conversation

Don-Vito
Copy link
Contributor

@Don-Vito Don-Vito commented Oct 9, 2020

This commit introduces two new launch modes: focus and maximizedFocus.

  • Focused mode, behaves like a default mode, but with the Focus Mode
    enabled.
  • Maximized focused mode, behaves like a Maximized mode, but with the
    Focus Mode enabled.

There two ways to invoke these new modes:

  • In the settings file: you set the "launchMode" to either "focus" or
    "maximizedFocus"
  • In the command line options, you can path -f / --focus, which is
    mutually exclusive with the --fullscreen, but can be combined with the
    --maximized:
    • Passing -f / --focus will launch the terminal in the "focus" mode
    • Passing -fM / --focus --maximized will launch the terminal in the
      "maximizedFocus" mode

This should resolve a relevant part in the command line arguments
mega-thread #4632

Closes #7124
Closes #7825
Closes #7875

… If one of them is set, focusedMode should be toggled on startup
@ghost ghost added Area-Settings Issues related to settings and customizability, for console or terminal Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal. labels Oct 9, 2020
@zadjii-msft
Copy link
Member

I love this. I think you've done the focused mode thing exactly right. My one concern - I'd yank the maximizedFocus mode. In my opinion, that's just the same thing as fullscreen mode 😄

@zadjii-msft zadjii-msft self-assigned this Oct 9, 2020
@zadjii-msft zadjii-msft added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Oct 9, 2020
@Don-Vito
Copy link
Contributor Author

Don-Vito commented Oct 9, 2020

I love this. I think you've done the focused mode thing exactly right. My one concern - I'd yank the maximizedFocus mode. In my opinion, that's just the same thing as fullscreen mode 😄

The only difference from the fullscreen is that in the maximized focused mode, you still see the taskbar (not sure how useful it is). Added this mode as it seems that in was originally mentioned in the feature request (#7124): "I want to have maximized and focused mode when app is launch" (#7124 (comment))

Please let me know if you prefer me to delete anyway.

@ghost ghost removed the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Oct 9, 2020
@zadjii-msft
Copy link
Member

Oh, fair point! Then I'm totally cool with this. I don't hate maximizedFocus either - I think maximized|focus would be wrong, because that would imply the whole set is flags that could be combined (they aren't). It's basically either maximizedFocus or focusMaximized, and I don't feel like there's a tangible difference between the two, so let's go with what's already been implemented 😛

@Don-Vito
Copy link
Contributor Author

Don-Vito commented Oct 9, 2020

Oh, fair point! Then I'm totally cool with this. I don't hate maximizedFocus either - I think maximized|focus would be wrong, because that would imply the whole set is flags that could be combined (they aren't). It's basically either maximizedFocus or focusMaximized, and I don't feel like there's a tangible difference between the two, so let's go with what's already been implemented 😛

Yay :)
Should I add some UTs? If so - can you please guide me to the framework that I can base on?
If not - should I mark this as "Ready for review"? (I am quite new with the Draft PRs, work with Azure DevOps mostly).

@zadjii-msft
Copy link
Member

Should I add some UTs?

Bless your soul ☺️

In this specific case, since this is such a UI-dependent feature, I think we're cool not adding any unit tests. The enum parsing is already pretty well tested, and I'm not sure we've got any sort of framework for testing the state of the Win32 window. I'd definitely mark this as "Ready for Review" 😄

@zadjii-msft zadjii-msft removed their assignment Oct 9, 2020
@Don-Vito Don-Vito marked this pull request as ready for review October 9, 2020 16:04
@Don-Vito Don-Vito changed the title 7124: Add focused and maximizedFocused launch modes 7124: Add focus and maximizedFocus launch modes Oct 9, 2020
@Don-Vito
Copy link
Contributor Author

Don-Vito commented Oct 10, 2020

@zadjii-msft - sorry for pushing another change after the approval (I was sure that this new commit will reset it, but for some reason it didn't).

I have noticed that in the megathread (#4632) there is also a request to add command-line option for this. So added it as well.

@Don-Vito Don-Vito marked this pull request as draft October 10, 2020 09:49
@Don-Vito Don-Vito marked this pull request as ready for review October 10, 2020 12:49
@zadjii-msft zadjii-msft self-assigned this Oct 12, 2020
Copy link
Member

@zadjii-msft zadjii-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you a mind reader?

I was gonna go ahead and sneak the cmdline argument in after this PR merged, but hey, you've gone and already done it. Thanks for the diligence! I quite like the elegance of -Mf for combining focus and maximized too

@zadjii-msft zadjii-msft removed their assignment Oct 12, 2020
@ghost ghost requested review from DHowett, leonMSFT and PankajBhojwani October 12, 2020 22:34
Copy link
Member

@DHowett DHowett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we'll need to update the schema in doc/cascadia! This looks excellent otherwise.

@ghost ghost added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Oct 13, 2020
@ghost ghost removed the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Oct 13, 2020
@Don-Vito
Copy link
Contributor Author

Added the schema to the cascadia docs. Should I do anything beyond validating that it works on different profile?
This schema corresponds to the documentation PR I put in the docs repo (MicrosoftDocs/terminal#158)

@Don-Vito Don-Vito requested a review from DHowett October 13, 2020 06:43
Copy link
Member

@lhecker lhecker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe you can drop MaximizedFocusMode.
You could get the same effect by calling wt.exe --focus --maximized instead, couldn't you?

@@ -175,14 +175,24 @@ void AppCommandlineArgs::_buildParser()
// -M,--maximized: Maximizes the window on launch
// -F,--fullscreen: Fullscreens the window on launch
auto maximizedCallback = [this](int64_t /*count*/) {
_launchMode = winrt::Microsoft::Terminal::Settings::Model::LaunchMode::MaximizedMode;
_launchMode = (_launchMode.has_value() && _launchMode.value() == winrt::Microsoft::Terminal::Settings::Model::LaunchMode::FocusMode) ?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can drop the winrt::Microsoft::Terminal::Settings::Model:: prefix, because the file already imports the namespace. 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Done!

@Don-Vito
Copy link
Contributor Author

I believe you can drop MaximizedFocusMode.
You could get the same effect by calling wt.exe --focus --maximized instead, couldn't you?

@lhecker - please guide me here. How do you suggest to encode the combination of --focus --maximized instead?

@Don-Vito
Copy link
Contributor Author

@DHowett - sorry for nagging, but CI is somewhat harsh with me today and I am not sure if I can somehow unblock this PR 😄

  • The github spelling complains about something I already fixed (I wrote betwen instead of between).
  • The OutputTests::BasicReadConsoleOutputATest fails - though it passes locally for me, and I can hardly follow the link between it and the change.

Copy link
Member

@DHowett DHowett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent, excellent stuff. Thank you!

@ghost ghost added the Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. label Oct 14, 2020
@DHowett
Copy link
Member

DHowett commented Oct 14, 2020

I have several questions regarding the feature and the PR

  • This is my first PR, please be gentle

This is excellent work for a first PR -- though your other work merged first! 😄
We're happy to have you.

  • I hesitated between introducing new launch modes or adding a separate setting for "startInFocused" mode. I >preferred not to introduce a new parameter, was this a good decision?

Looks like we went w/ a parameter.

  • Didn't updated the documentation yet - wanted to hear your opinion first.

All set!

  • Not sure how to test this in UT. Didn't find UT for other modes.

@zadjii-msft summed it up quite nicely.

  • Didn't add those modes to args. Please let me know if required (and if so, the names of the options)

All set again! 😁

@DHowett DHowett added the AutoMerge Marked for automatic merge by the bot when requirements are met label Oct 14, 2020
@ghost
Copy link

ghost commented Oct 14, 2020

Hello @DHowett!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

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 (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit f86045e into microsoft:master Oct 14, 2020
carlos-zamora added a commit that referenced this pull request Oct 30, 2020
## Summary of the Pull Request
Since we've started working on the Settings UI, a few settings have been added on `main`. This adds those missing settings over. 

## References
Missing settings include...
- #7364: `disableAnimations`
- #7873: `launchMode` `focus` and `maximizedFocus`
- #7793: `bellStyle`

## Validation Steps Performed
Verified that those settings appear properly in the Settings UI.
@ghost
Copy link

ghost commented Nov 11, 2020

🎉Windows Terminal Preview v1.5.3142.0 has been released which incorporates this pull request.:tada:

Handy links:

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Settings Issues related to settings and customizability, for console or terminal AutoMerge Marked for automatic merge by the bot when requirements are met hacktoberfest-accepted Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Issue-Task It's a feature request, but it doesn't really need a major design. Needs-Second It's a PR that needs another sign-off Product-Terminal The new Windows Terminal.
Projects
None yet
4 participants