-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
Allow creating and editing unfocused appearances in the SUI #10317
Conversation
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.
Looks like you're making good progress 😊
// make sure to send all the property changed events once here | ||
// we do this in the case an old appearance was deleted and then a new one is created, | ||
// the old settings need to be updated in xaml |
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.
Hmm... could we somehow detect something like "AppearanceChanged"?
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's what's happening here already! (Note that we only get here from the _ViewModelChanged
event)
The thing is the Appearances
object (not the view model) has some settings that xaml binds to (like CurrentColorScheme
) that hang around even if the view model is deleted, then when a new view model is created we need to tell xaml that these settings may have changed
void CreateUnfocusedAppearance(); | ||
void DeleteUnfocusedAppearance(); | ||
|
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.
You can probably remove these two functions and just go through the profile instead, right? These don't feel like they should be a part of the navigation state.
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.
Unfortunately we need some way to pass the list of color schemes and the window root to the profile view model for it to create an appearance view model. The PVM doesn't have the list of color schemes nor the window root, only the navigation state does.
07cf8f2
to
9a6d580
Compare
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.
Mostly nits. I'd still like a demo of this in the teams chat before approving.
src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw
Outdated
Show resolved
Hide resolved
<Button.Resources> | ||
<ResourceDictionary> | ||
<ResourceDictionary.ThemeDictionaries> | ||
<ResourceDictionary x:Key="Light"> | ||
<SolidColorBrush x:Key="ButtonBackground" | ||
Color="Firebrick" /> | ||
<SolidColorBrush x:Key="ButtonBackgroundPointerOver" | ||
Color="#C23232" /> | ||
<SolidColorBrush x:Key="ButtonBackgroundPressed" | ||
Color="#A21212" /> | ||
<SolidColorBrush x:Key="ButtonForeground" | ||
Color="White" /> | ||
<SolidColorBrush x:Key="ButtonForegroundPointerOver" | ||
Color="White" /> | ||
<SolidColorBrush x:Key="ButtonForegroundPressed" | ||
Color="White" /> | ||
</ResourceDictionary> | ||
<ResourceDictionary x:Key="Dark"> | ||
<SolidColorBrush x:Key="ButtonBackground" | ||
Color="Firebrick" /> | ||
<SolidColorBrush x:Key="ButtonBackgroundPointerOver" | ||
Color="#C23232" /> | ||
<SolidColorBrush x:Key="ButtonBackgroundPressed" | ||
Color="#A21212" /> | ||
<SolidColorBrush x:Key="ButtonForeground" | ||
Color="White" /> | ||
<SolidColorBrush x:Key="ButtonForegroundPointerOver" | ||
Color="White" /> | ||
<SolidColorBrush x:Key="ButtonForegroundPressed" | ||
Color="White" /> | ||
</ResourceDictionary> | ||
<ResourceDictionary x:Key="HighContrast"> | ||
<SolidColorBrush x:Key="ButtonBackground" | ||
Color="{ThemeResource SystemColorButtonFaceColor}" /> | ||
<SolidColorBrush x:Key="ButtonBackgroundPointerOver" | ||
Color="{ThemeResource SystemColorHighlightColor}" /> | ||
<SolidColorBrush x:Key="ButtonBackgroundPressed" | ||
Color="{ThemeResource SystemColorHighlightColor}" /> | ||
<SolidColorBrush x:Key="ButtonForeground" | ||
Color="{ThemeResource SystemColorButtonTextColor}" /> | ||
<SolidColorBrush x:Key="ButtonForegroundPointerOver" | ||
Color="{ThemeResource SystemColorHighlightTextColor}" /> | ||
<SolidColorBrush x:Key="ButtonForegroundPressed" | ||
Color="{ThemeResource SystemColorHighlightTextColor}" /> | ||
</ResourceDictionary> | ||
</ResourceDictionary.ThemeDictionaries> | ||
</ResourceDictionary> | ||
</Button.Resources> |
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.
Seeing this gave me an idea: #10454
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'm open to updating this once a PR for that goes through!
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.
Discussed offline. Try making the "Unfocused appearance" a title instead of a "subtitle" to see if that helps it pop more and help differentiate it from the subgroups. Other than that, looks great! :)
We'll iterate on the design. I'm sure the team'll give more feedback once it's merged to main and we get a build to selfhost.
want to slap a til::feature on it? to make sure it only happens in preview? |
Good idea, done! |
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 (
|
What about a pivot within the "Appearance" section, with Focused and Unfocused? |
|
||
bool ProfileViewModel::EditableUnfocusedAppearance() | ||
{ | ||
if constexpr (Feature_EditableUnfocusedAppearance::IsEnabled()) |
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 the same as "return Feature_x::IsEnabled()"
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.
Curious: isn't this technically faster because of the if constexpr
? I suppose straight up returning IsEnabled()
wouldn't be much slower haha, unless it's inline/constexpr? idk much about this stuff hahaha
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.
No. The compiler is smart enough to optimize...
if (true) { return true; }
return false;
into
return true;
on its own.
🎉 Handy links: |
Summary of the Pull Request
Adds unfocused appearance creation/configuration in the SUI
There is now an 'Unfocused Appearance' section at the bottom of the 'Appearance' tab in a profile. There is a '+' button to create an unfocused appearance if one does not exist, or a delete button to delete the unfocused appearance if one exists (only one of these buttons is visible at a time).
PR Checklist
Validation Steps Performed