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

Add support for setting tabColor on the command line #8102

Merged
17 commits merged into from
Nov 20, 2020

Conversation

Don-Vito
Copy link
Contributor

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

  • Add a tabColor parameter to the new-tab and split-panes command
  • Add --tabColor to the command line, to allow bootstrapping with tabs
    of different colors

Add another field to NewTerminalArgs. Use this field to set
StartingTabColor in Terminal. This color gets overridden by the color
defined by the profile / VT, however can be overridden with the color
picker.

Since the color is the property of the Terminal, when defined for the
tab this color is associated only with the first pane/terminal of the
tab. Additional panes will not inherit this color (to prevent advanced
resolution, where we need to resolve between the inherited color and the
one specified for the pane).

Validation Steps Performed

  • UT for parameters parsing
  • Running system with several tabs of different colors.
  • Adding custom actions with colors
  • Performing operations like split pane, duplicate and so on

Closes #8075

@ghost ghost added Area-Commandline wt.exe's commandline arguments Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal. labels Oct 30, 2020
@Don-Vito
Copy link
Contributor Author

Don-Vito commented Nov 2, 2020

@zadjii-msft - our CI is impossible 😄 All tests past locally but are flaky as hell when running in pipelines.

@zadjii-msft zadjii-msft self-assigned this Nov 2, 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.

These are kinda just nits, but I do think the Windows::UI::Color thing would be slightly cleaner.

Otherwise, great job here!

src/cascadia/TerminalSettingsModel/ActionArgs.h Outdated Show resolved Hide resolved
src/cascadia/TerminalApp/Resources/en-US/Resources.resw Outdated Show resolved Hide resolved
@ghost ghost added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Nov 3, 2020
@zadjii-msft zadjii-msft assigned Don-Vito and unassigned zadjii-msft Nov 3, 2020
@ghost ghost removed the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Nov 3, 2020
@Don-Vito Don-Vito removed their assignment Nov 5, 2020
@Don-Vito
Copy link
Contributor Author

@zadjii-msft - fixed, please re-review 😊

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.

Yea, this is the stuff. Great work!

@zadjii-msft zadjii-msft added the Needs-Second It's a PR that needs another sign-off label Nov 10, 2020
@Don-Vito
Copy link
Contributor Author

@zadjii-msft, @DHowett - I have created an alternative implementation where I add tabColor only to NewTabArgs. Please let me know if you prefer that variant, or you believe we do need to add tabColor for split-pane. In the latter case I need your help with understanding the expected behavior.

Bump - so I can advance on week-end

@DHowett
Copy link
Member

DHowett commented Nov 13, 2020

So it's interesting. A profile can set a tabColor, which means that panes technically have one. I'll need @zadjii-msft to weigh in.

It might boil down to "it should be like a title -- the focused pane wins -- we just didn't do it like that"

@Don-Vito
Copy link
Contributor Author

So it's interesting. A profile can set a tabColor, which means that panes technically have one. I'll need @zadjii-msft to weigh in.

It might boil down to "it should be like a title -- the focused pane wins -- we just didn't do it like that"

@DHowett - cool. I will try to implement this approach as well and then we can choose 😊

@Don-Vito
Copy link
Contributor Author

@DHowett , @zadjii-msft - changed the implementation to set the color on the pane level.
However, I could not use existing hierarchy:

  • runtimeTabColor - is not good enough as it is on the tab level
  • Terminal::TabColor - is not good enough, as it gets overridden upon settings reload

Hence I added a StartingTitle to TermControl, I was not sure if I should add it to TermControl or Terminal itself (I will probably move it to Terminal in a separate PR, and merge to here if required)

@Don-Vito
Copy link
Contributor Author

I decided to move everything to Terminal, we'll see if it was a good decision 😄

@Don-Vito
Copy link
Contributor Author

@zadjii-msft - I added the starting tab color to be a property of the Terminal. Consequently, when a new tab is created the color is set on the first pane. But if we split the tab the color is not set on the second pane. We could say that the color will be applied for all panes of the tab, but this gets complicated, as the color can be also specified on the second pane as well. Which will require us to resolve what color is preferable. This is possible, but I am not sure if we want to get there product-wise. WDYT?

@Don-Vito
Copy link
Contributor Author

This is awesome! Just link the PR for the updated docs and I'll approve. Thanks!

Updated the docs. Thanks!

@Don-Vito
Copy link
Contributor Author

Bumping this as it works pretty cool 😊

@zadjii-msft
Copy link
Member

Okay, sorry for the delay reviewing this. You're churning out so many dang PRs, it's hard to keep up 😄

I've played with the branch as it is this morning, and I like how it feels. And it feels like what I originally described in #8075. Plus, being resilient to a settings reload is a clever solution.

I'll sanity check the code now, but it definitely feels 👌

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.

Oh yea I already reviewed 90% of this. This looks good to me!

Copy link
Member

@carlos-zamora carlos-zamora left a comment

Choose a reason for hiding this comment

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

I guess I'm ok with this. I like the feature. I don't like the TabColor vs StartingTabColor thing, but I'll just have to live with it since it seems to be the best approach tbh.

src/cascadia/TerminalCore/Terminal.cpp Outdated Show resolved Hide resolved
Comment on lines 71 to 72
GETSET_PROPERTY(Windows::Foundation::IReference<uint32_t>, TabColor, nullptr);
GETSET_PROPERTY(Windows::Foundation::IReference<uint32_t>, StartingTabColor, nullptr);
Copy link
Member

Choose a reason for hiding this comment

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

@DHowett or @zadjii-msft:
Should we have a comment here or somewhere describing the difference between these two properties? I understand that we need StartingTabColor, but I have a feeling it'll be confusing to have both down the road.

Copy link
Contributor Author

@Don-Vito Don-Vito Nov 18, 2020

Choose a reason for hiding this comment

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

@carlos-zamora - I totally agree with you that it is both confusing and error-prone. Instead I would like to:

  1. Introduce "ITerminalCreationParams" and move this property there.
  2. Pass them upon construction

However this will require changing the Terminal interface, that I felt is somewhat above my paygrade at this stage.

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.

This is great. We'll need to get the TerminalSettings back into check because sometimes we use it to communicate app-only state, but I'm happy with this for now.

@DHowett DHowett changed the title 8075: Set tab color in command line Add support for setting tabColor on the command line Nov 20, 2020
@DHowett DHowett added the AutoMerge Marked for automatic merge by the bot when requirements are met label Nov 20, 2020
@ghost
Copy link

ghost commented Nov 20, 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 fd37e1d into microsoft:main Nov 20, 2020
mpela81 pushed a commit to mpela81/terminal that referenced this pull request Nov 22, 2020
* Add a tabColor parameter to the `new-tab` and `split-panes` command
* Add --tabColor to the command line, to allow bootstrapping with tabs
  of different colors

Add another field to NewTerminalArgs. Use this field to set
StartingTabColor in Terminal. This color gets overridden by the color
defined by the profile / VT, however can be overridden with the color
picker.

Since the color is the property of the Terminal, when defined for the
tab this color is associated only with the first pane/terminal of the
tab. Additional panes will not inherit this color (to prevent advanced
resolution, where we need to resolve between the inherited color and the
one specified for the pane).

## Validation Steps Performed
* UT for parameters parsing
* Running system with several tabs of different colors.
* Adding custom actions with colors
* Performing operations like split pane, duplicate and so on

Closes microsoft#8075
@Don-Vito Don-Vito deleted the fet/8075-color-tab branch December 3, 2020 17:03
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-Commandline wt.exe's commandline arguments AutoMerge Marked for automatic merge by the bot when requirements are met 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
Development

Successfully merging this pull request may close these issues.

Set tab color in command line
4 participants