Skip to content

Add titlebar acrylic#10864

Merged
3 commits merged intomicrosoft:mainfrom
matthew4850:main
Aug 23, 2021
Merged

Add titlebar acrylic#10864
3 commits merged intomicrosoft:mainfrom
matthew4850:main

Conversation

@matthew4850
Copy link
Contributor

Add support for acrylic in the titlebar

PR Checklist

  • CLA signed

Detailed Description of the Pull Request / Additional comments

This seems to be a highly requested feature and seeing as #5772 was closed I thought it made sense to make a PR for this.
image

Validation Steps Performed

Checked that acrylic works in both dark and light modes and switching between them still works. Also checked that acrylic in the tab row still works when tabs in titlebar is disabled.

@zadjii-msft
Copy link
Member

Okay so I love this, and is almost certainly exactly how I'd implement it.

I might have not been the most clear when I closed #5772. I do plan on coming back to XAML theming (#3327). It's my personal passion project, probably one of the features that I'm most excited about. I unfortunately have other priorities that are more important right now (mainly #5000), so I'm pretty confident that #3327 isn't going to land in the 2.0 timeframe. I know the team wasn't going to have the time to come through and review that spec in any short order (it's already 12 months old haha). Plus, the spec needed a decent amount of additional work to reconcile it with Mica. I thought it best to close the spec PR for now and help clear out the PR backlog, and re-open when the team actually will have a chance to review.

I don't want to be the kind of person who turns away valid and valuable community contributions in the name of "the big picture". I especially don't want to do that when I have no idea when the big picture will work itself out. So I'm gonna give this a think for a while to see if there's a reasonable way to accept this now and reconcile with themes later.

@zadjii-msft zadjii-msft added the Needs-Discussion Something that requires a team discussion before we can proceed label Aug 5, 2021
@matthew4850
Copy link
Contributor Author

Okay so I love this, and is almost certainly exactly how I'd implement it.

Thank you so much for this, I am new to C++/WinRT so it really means a lot.

I might have not been the most clear when I closed #5772. I do plan on coming back to XAML theming (#3327). It's my personal passion project, probably one of the features that I'm most excited about. I unfortunately have other priorities that are more important right now (mainly #5000), so I'm pretty confident that #3327 isn't going to land in the 2.0 timeframe. I know the team wasn't going to have the time to come through and review that spec in any short order (it's already 12 months old haha). Plus, the spec needed a decent amount of additional work to reconcile it with Mica. I thought it best to close the spec PR for now and help clear out the PR backlog, and re-open when the team actually will have a chance to review.

I don't want to be the kind of person who turns away valid and valuable community contributions in the name of "the big picture". I especially don't want to do that when I have no idea when the big picture will work itself out. So I'm gonna give this a think for a while to see if there's a reasonable way to accept this now and reconcile with themes later.

I hope it shouldn't be too hard to reconcile with themes, when necessary I think it should be possible to just remove this code and have some kind of auto-upgrade for the settings to something compliant with themes.

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.

Okay, team consensus was that we're okay doing this for now, and migrating it to themes when themes arrive in ~3.0. We're not going to take any of the other titlebar theming settings in 2.0.

(We might take a fix for following the system setting for "use accent color in the titlebar", but with an opt-out setting (that again, would be migrated to themes in 3.0). The rest of the theming asks though will have to wait.)

I'm okay with

  • this setting not hot-reloading right now. The team can always follow up and add that if needed
  • the team can come through and link this up to the settings UI in a follow-up, no need to delay this PR any longer. It's already in the SUI!

Thanks again for the contribution here!

@zadjii-msft zadjii-msft added Area-Theming Anything related to the theming of elements of the window Needs-Second It's a PR that needs another sign-off Product-Terminal The new Windows Terminal. and removed Needs-Discussion Something that requires a team discussion before we can proceed labels Aug 10, 2021
@matthew4850
Copy link
Contributor Author

the team can come through and link this up to the settings UI in a follow-up, no need to delay this PR any longer.

I might be misunderstanding but the PR already contains a setting UI toggle.

@zadjii-msft
Copy link
Member

I might be misunderstanding but the PR already contains a setting UI toggle.

omfg it does. I forgot how easy it is to add settings to the SUI sometimes, that I completely forgot that I had read that code. Ignore 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.

This looks great! A few things before I sign off:

  • Please add useAcrylicInTabRow to the schema
  • Please add this to the docs repo
  • Please file a follow-up issue for this to be hot-reloadable

Comment on lines +785 to +796
const auto backgroundSolidBrush = backgroundBrush.try_as<Media::SolidColorBrush>();
const auto backgroundAcrylicBrush = backgroundBrush.try_as<Media::AcrylicBrush>();

til::color backgroundColor = Colors::Black();
if (backgroundSolidBrush)
{
backgroundColor = backgroundSolidBrush.Color();
}
else if (backgroundAcrylicBrush)
{
backgroundColor = backgroundAcrylicBrush.FallbackColor();
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const auto backgroundSolidBrush = backgroundBrush.try_as<Media::SolidColorBrush>();
const auto backgroundAcrylicBrush = backgroundBrush.try_as<Media::AcrylicBrush>();
til::color backgroundColor = Colors::Black();
if (backgroundSolidBrush)
{
backgroundColor = backgroundSolidBrush.Color();
}
else if (backgroundAcrylicBrush)
{
backgroundColor = backgroundAcrylicBrush.FallbackColor();
}
til::color backgroundColor = Colors::Black();
if (const auto backgroundSolidBrush = backgroundBrush.try_as<Media::SolidColorBrush>())
{
backgroundColor = backgroundSolidBrush.Color();
}
else if (const auto backgroundAcrylicBrush = backgroundBrush.try_as<Media::AcrylicBrush>())
{
backgroundColor = backgroundAcrylicBrush.FallbackColor();
}

Totally optional. This'll make it so that the brushes are available in a smaller scope.

<comment>Header for a control to toggle whether acrylic shows in the tab row. Changing this setting requires the user to relaunch the app.</comment>
</data>
<data name="Globals_AcrylicTabRow.HelpText" xml:space="preserve">
<value>When checked, the tab row will have the acrylic material.</value>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<value>When checked, the tab row will have the acrylic material.</value>
<value>When enabled, the tab row will have the acrylic material.</value>

@ghost ghost added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Aug 10, 2021
@ghost ghost added the No-Recent-Activity This issue/PR is going stale and may be auto-closed without further activity. label Aug 18, 2021
@ghost
Copy link

ghost commented Aug 18, 2021

This pull request has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within 7 days of this comment.

@zadjii-msft
Copy link
Member

@carlos-zamora Mind if we do those in post? Not sure I want to necessarily force an external contributor to comply with the fullness of our bureaucracy 😜

@ghost ghost removed the No-Recent-Activity This issue/PR is going stale and may be auto-closed without further activity. label Aug 20, 2021
@zadjii-msft
Copy link
Member

Ah shoot, there are merge conflicts though - @matthew4850 if you want to fix those, otherwise I might just try on monday

@matthew4850
Copy link
Contributor Author

@carlos-zamora apologise for not getting round to your requested changes, I was away and only just got back.

@ghost ghost removed the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Aug 21, 2021
@matthew4850
Copy link
Contributor Author

Ah shoot, there are merge conflicts though - @matthew4850 if you want to fix those, otherwise I might just try on monday

Resolved 🙂

@carlos-zamora
Copy link
Member

@carlos-zamora apologise for not getting round to your requested changes, I was away and only just got back.

No worries. Thank YOU for doing this! 🙂

@carlos-zamora carlos-zamora added the AutoMerge Marked for automatic merge by the bot when requirements are met label Aug 23, 2021
@ghost
Copy link

ghost commented Aug 23, 2021

Hello @carlos-zamora!

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 ed7c716 into microsoft:main Aug 23, 2021
@ghost
Copy link

ghost commented Aug 31, 2021

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

Handy links:

carlos-zamora pushed a commit that referenced this pull request Sep 2, 2021
`useAcrylicInTabRow` was missing from the JSON schema, so I added it in.

## References
#10864 

## PR Checklist
* [x] Closes #11087 
* [x] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA
* [x] Schema updated.
ghost pushed a commit that referenced this pull request Feb 15, 2022
This has been a saga.

Basically, any resources in `App.xaml` aren't going to be able to reference other theme-aware resources. We can't change the theme of the app at runtime, only elements within the app. So we can't use `ApplicationPageBackgroundThemeBrush` in app.xaml, because it will ALWAYS be evaluated as the OS theme version of that brush.

* regressed in #12326
* See also #10864
* #3917 CANNOT be fixed in the same way. We're lucky here that the TabView uses a `{ThemeResource TabViewBackground}` in markup to set the bg. We're not similarly lucky with the Pane one. 
* [x] closes #12356
* [x] Tested manually. You can confirm, my eyes are bleeding from the OS-wide light mode
DHowett pushed a commit that referenced this pull request Feb 16, 2022
This has been a saga.

Basically, any resources in `App.xaml` aren't going to be able to reference other theme-aware resources. We can't change the theme of the app at runtime, only elements within the app. So we can't use `ApplicationPageBackgroundThemeBrush` in app.xaml, because it will ALWAYS be evaluated as the OS theme version of that brush.

* regressed in #12326
* See also #10864
* #3917 CANNOT be fixed in the same way. We're lucky here that the TabView uses a `{ThemeResource TabViewBackground}` in markup to set the bg. We're not similarly lucky with the Pane one.
* [x] closes #12356
* [x] Tested manually. You can confirm, my eyes are bleeding from the OS-wide light mode

(cherry picked from commit 5ba0d61)
zadjii-msft added a commit that referenced this pull request Mar 3, 2022
This has been a saga.

Basically, any resources in `App.xaml` aren't going to be able to reference other theme-aware resources. We can't change the theme of the app at runtime, only elements within the app. So we can't use `ApplicationPageBackgroundThemeBrush` in app.xaml, because it will ALWAYS be evaluated as the OS theme version of that brush.

* regressed in #12326
* See also #10864
* #3917 CANNOT be fixed in the same way. We're lucky here that the TabView uses a `{ThemeResource TabViewBackground}` in markup to set the bg. We're not similarly lucky with the Pane one. 
* [x] closes #12356
* [x] Tested manually. You can confirm, my eyes are bleeding from the OS-wide light mode
@zadjii-msft zadjii-msft mentioned this pull request Jun 13, 2022
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-Theming Anything related to the theming of elements of the window AutoMerge Marked for automatic merge by the bot when requirements are met 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.

3 participants