-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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 the Settings UI #8048
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.
Only minor comments. Let's do this!
src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw
Outdated
Show resolved
Hide resolved
Random thought while reading: we might want to actually make an updated version of |
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.
okay I'm at 69/90 but I think he's finally asleep so I'm going to bed
TabViewItem().IconSource(IconPathConverter::IconSourceMUX(glyph)); | ||
|
||
// Update SwitchToTab command's icon | ||
SwitchToTabCommand().Icon(glyph); |
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.
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.
@zadjii-msft - not sure about the git but the compiler will complain for sure :) In any case the solution will be straightforwad - removing this line since the palette items are "bound" to TabBase::Icon
.
Foundation::IInspectable const& /* parameter */, | ||
hstring const& /* language */) | ||
{ | ||
return winrt::box_value(Windows::UI::Xaml::Media::SolidColorBrush(winrt::unbox_value<Windows::UI::Color>(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.
do we have to worry about this unbox_value
throwing an exception if value
isn't a Color
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.
Technically, yes. But considering that this is a Color-to-Brush converter, I feel like this is fine? (also, idk how to check the type of something without unboxing it, would try_as
work?)
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.
yea, try_as
returns null if it couldn't do the conversion.
src/cascadia/TerminalSettingsEditor/Microsoft.Terminal.Settings.Editor.filters
Outdated
Show resolved
Hide resolved
src/cascadia/TerminalSettingsEditor/Microsoft.Terminal.Settings.Editor.filters
Outdated
Show resolved
Hide resolved
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.
Okay, I'm through 90/90. I've got a pile of nits and questions so I'll hold for answers, but there's nothing dramatic here
_State.WindowRoot().TryPropagateHostingWindow(picker); // if we don't do this, there's no HWND for it to attach to | ||
picker.ViewMode(PickerViewMode::Thumbnail); | ||
picker.SuggestedStartLocation(PickerLocationId::ComputerFolder); | ||
picker.FileTypeFilter().ReplaceAll({ L".bat", L".exe", L".cmd" }); |
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.
wait, we definitely can't put .bat
or .cmd
's in here directly -
holy shit what, you can CreateProcess(foo.bat)
and it works? That's insane.
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.
Either way, if you do select a .bat
file, then apply, it seems to roundtrip it as cmd.exe
. Not sure if that counts as a follow-up though
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.
Wait that might just be it's not persisting at all. That's probably something else, nevermind me.
|
||
fire_and_forget Profiles::StartingDirectory_Click(IInspectable const&, RoutedEventArgs const&) | ||
{ | ||
auto lifetime = get_strong(); |
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.
Should these be weak refs that we check on the other side of the co_await
?
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'll be honest, I straight up took this from the FilePicker Sample. We don't even use lifetime
. I'll have to play around a bit here to see if that works. I'll get back to you.
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.
so, it really doesn't matter. lifetime
anchors the page so that it stays alive while the button click handler is being run.
That's a good thing.
We've gone crazy with the weak references in Terminal. We make them weak, check if they're alive, all the dang time
_tabs.Append(*newTabImpl); | ||
_mruTabActions.Append(newTabImpl->SwitchToTabCommand()); | ||
|
||
newTabImpl->SetDispatch(*_actionDispatch); | ||
|
||
// Give the tab its index in the _tabs vector so it can manage its own SwitchToTab command. | ||
_UpdateTabIndices(); | ||
|
||
// Don't capture a strong ref to the tab. If the tab is removed as this | ||
// is called, we don't really care anymore about handling the event. | ||
auto weakTab = make_weak(newTabImpl); | ||
|
||
auto tabViewItem = newTabImpl->TabViewItem(); | ||
_tabView.TabItems().Append(tabViewItem); |
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.
A lot of this seems similar to the setup we do when we create a terminal tab, should we make a card to unify it?
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 was some of the code that Leon wrote up. I'm a bit worried that I may break some tab switching functionality in the process of moving stuff around. For now, I've lumped it into #8452 since that seems to be touching some similar code. I'll do it as a follow-up to this PR since this is already a pretty big one.
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.
okay. lets do this. We can polish in post
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="*"></ColumnDefinition> | ||
</Grid.ColumnDefinitions> | ||
<TextBlock x:Uid="Settings_UnsavedSettingsWarning" |
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 currently isnt used, right?
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.
Correct. We need a way to detect unsaved changes to properly show/hide it. #8552 starts getting us there, so I'll keep it in there for now. But I'll definitely add a comment explaining that (and filing a follow-up)
@@ -168,7 +167,7 @@ struct ::Microsoft::Terminal::Settings::Model::JsonUtils::ConversionTrait<::winr | |||
} | |||
|
|||
::winrt::Windows::UI::Text::FontWeight weight{ | |||
static_cast<uint16_t>(std::clamp(value, 100u, 990u)) | |||
static_cast<uint16_t>(std::clamp(value, 1u, 999u)) |
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 sorry, what? 1 is not a valid font weight
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 sorry, what? 1 is not a valid font weight
Typically goes from 100 to 990 I think - but I believe the font sets its minimum and maximum values?
https://docs.microsoft.com/en-us/typography/opentype/spec/fvar
Example This example is for a hypothetical font with family name “SelawikV” that has two axes of variation, for weight and width. This table summarizes the description of the axes for the font:
Axis tag | Minimum value | Default value | Maximum value | Axis name ID |
---|---|---|---|---|
'wght' | 300 | 400 | 700 | 256 |
'wdth' | 62.5 | 100 | 150 | 257 |
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.
But the documentation for FontWeight says that this is the supported range though. Do we clamp it somewhere else?
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 backed this out and clamped it to 100 on deserialization. On a round trip it will be "fixed".
This commit is an amalgamation of some of the TSM changes in PR #8048. It: * Introduces CascadiaSettings.CreateNewProfile to add a new profile * Introduces CascadiaSettings.ProfileDefaults, which returns the "defaults" object as a profile * Fixes the font weight deserializer to work on uint16_ts * Fixes a property getter in ColorScheme to not be a property getter * Fixes a reserialization error with default profiles * Sets a default icon for all profiles (to the C:\ Segoe MDL2 icon)
This commit introduces the terminal settings editor (to wit: the Settings UI) as a standalone project. This project, and this commit, is the result of two and a half months of work. TSE started as a hackathon project in the Microsoft 2020 Hackathon, and from there it's grown to be a bona-fide graphical settings editor. There is a lot of xaml data binding in here, a number of views and a number of view models, and a bunch of paradigms that we've been reviewing and testing out and designing and refining. Specified in #6720, #8269 Follow-up work in #6800 Closes #1564 Closes #8048 (PR) Co-authored-by: Carlos Zamora <carlos.zamora@microsoft.com> Co-authored-by: Kayla Cinnamon <cinnamon@microsoft.com> Co-authored-by: Alberto Medina Gutierrez <almedina@microsoft.com> Co-authored-by: John Grandle <jograndl@microsoft.com> Co-authored-by: xerootg <xerootg@users.noreply.github.com> Co-authored-by: Scott <sarmiger1@gmail.com> Co-authored-by: Vineeth Thomas Alex <vineeththomasalex@gmail.com> Co-authored-by: Leon Liang <lelian@microsoft.com> Co-authored-by: Dustin L. Howett <duhowett@microsoft.com> Signed-off-by: Dustin L. Howett <duhowett@microsoft.com>
81a50de
to
0cab86f
Compare
This commit introduces the terminal settings editor (to wit: the Settings UI) as a standalone project. This project, and this commit, is the result of two and a half months of work. TSE started as a hackathon project in the Microsoft 2020 Hackathon, and from there it's grown to be a bona-fide graphical settings editor. There is a lot of xaml data binding in here, a number of views and a number of view models, and a bunch of paradigms that we've been reviewing and testing out and designing and refining. Specified in #6720, #8269 Follow-up work in #6800 Closes #1564 Closes #8048 (PR) Co-authored-by: Carlos Zamora <carlos.zamora@microsoft.com> Co-authored-by: Kayla Cinnamon <cinnamon@microsoft.com> Co-authored-by: Alberto Medina Gutierrez <almedina@microsoft.com> Co-authored-by: John Grandle <jograndl@microsoft.com> Co-authored-by: xerootg <xerootg@users.noreply.github.com> Co-authored-by: Scott <sarmiger1@gmail.com> Co-authored-by: Vineeth Thomas Alex <vineeththomasalex@gmail.com> Co-authored-by: Leon Liang <lelian@microsoft.com> Co-authored-by: Dustin L. Howett <duhowett@microsoft.com> Signed-off-by: Dustin L. Howett <duhowett@microsoft.com>
This commit is an amalgamation of some of the TSM changes in PR microsoft#8048. It: * Introduces CascadiaSettings.CreateNewProfile to add a new profile * Introduces CascadiaSettings.ProfileDefaults, which returns the "defaults" object as a profile * Fixes the font weight deserializer to work on uint16_ts * Fixes a property getter in ColorScheme to not be a property getter * Fixes a reserialization error with default profiles * Sets a default icon for all profiles (to the C:\ Segoe MDL2 icon)
This commit introduces the terminal settings editor (to wit: the Settings UI) as a standalone project. This project, and this commit, is the result of two and a half months of work. TSE started as a hackathon project in the Microsoft 2020 Hackathon, and from there it's grown to be a bona-fide graphical settings editor. There is a lot of xaml data binding in here, a number of views and a number of view models, and a bunch of paradigms that we've been reviewing and testing out and designing and refining. Specified in microsoft#6720, microsoft#8269 Follow-up work in microsoft#6800 Closes microsoft#1564 Closes microsoft#8048 (PR) Co-authored-by: Carlos Zamora <carlos.zamora@microsoft.com> Co-authored-by: Kayla Cinnamon <cinnamon@microsoft.com> Co-authored-by: Alberto Medina Gutierrez <almedina@microsoft.com> Co-authored-by: John Grandle <jograndl@microsoft.com> Co-authored-by: xerootg <xerootg@users.noreply.github.com> Co-authored-by: Scott <sarmiger1@gmail.com> Co-authored-by: Vineeth Thomas Alex <vineeththomasalex@gmail.com> Co-authored-by: Leon Liang <lelian@microsoft.com> Co-authored-by: Dustin L. Howett <duhowett@microsoft.com> Signed-off-by: Dustin L. Howett <duhowett@microsoft.com>
…t#8048) This commit iontroduces another `target` to the `openSettings` binding: `settingsUI`. It opens the settings UI introduced in the previous commit. Closes microsoft#1564 Closes microsoft#8048 (PR) Co-authored-by: Carlos Zamora <carlos.zamora@microsoft.com> Co-authored-by: Leon Liang <lelian@microsoft.com>
Summary of the Pull Request
This introduces the Settings UI to Windows Terminal. This allows users to customize their global settings, color schemes, and profiles without having to open the settings.json. Actions are not currently included in the Settings UI.
To open the Settings UI, add the following keybinding to your settings.json:
Closes #1564 - Settings UI
Spec: #6720, #8269
Demo