Prepare for per-window settings#20328
Open
zadjii-msft wants to merge 18 commits into
Open
Conversation
…n AppLogic on startup
…icrosoft/terminal into user/migrie/per-window-prequel
…icrosoft/terminal into user/migrie/per-window-prequel
carlos-zamora
requested changes
Jun 25, 2026
carlos-zamora
left a comment
Member
There was a problem hiding this comment.
Ok. I reviewed the PR and took a look at how it's used in part 2 (PR #20329) to get an idea of the feature being implemented.
Off the bat, the main design/architecture issues I have are...
- I don't like that
WindowSettingsis now everywhere. Though the changes are mechanical, it feels weird that everywhere in the code now has a responsibility of knowing what window we're in so that we can retrieve the right set of settings. I'd rather that that's only/mainly the responsibility of the settings model layer, so that each consumer just has to say "give me the value of this setting" rather than "give me the value in this window". I get why that's not the case, but I have an idea on how to fix it (more below). - I don't like that the settings are using
themesto apply them. Themes sound like they are intended to be purely visual. In MTSMSettings.h, I see thatMTSM_GLOBAL_ONLY_SETTINGSare settings that cannot differ across windows (good), but there's a good amount of settings inMTSM_WINDOW_SETTINGSthat don't make sense to me. For example,copyOnSelect,scrollToXare more interactivity-focused, so it would be weird to have two different windows have two different interaction behaviors. I also personally don't like that themes isn't in the settings UI yet, but that's a broader issue, so I feel weird about adding more functionality to an area that isn't exposed there yet. - (maybe more of a question for part 2) Should settings changed at runtime (i.e. "toggle always on top") be preserved? I think that would make sense.
I've been thinking about how these issues can be addressed. Some ideas:
- Replace
WindowSettings+GlobalAppSettingscoupling withGlobalAppSettingsinheritanceIInheritablealready does the kind of behavior I want: consumer calls a getter for a setting (i.e.AlwaysShowTabs()) and they just get the value directly without needing to think about the context. If we can use this, we could removeWindowSettingsDefaults()entirely because the value would just be resolved by the getter nice and clean.Profilealready has a similar system with profile defaults, so doing something like this would be more consistent.- One of the main issues right now is that
GlobalAppSettingscarries around_actionMap,_colorSchemes, and_themes. That said, I think we could just move them up toCascadiaSettingsand it shouldn't be too much trouble. Honestly, it would make more sense like that anyways.
- Directly allow global settings to be set in each "windows" entry
- I think this is more intuitive. Again, it follows the design of profiles and profile defaults, so it should be much easier to understand. Means that you can have
dockWindowbe a global setting too.
- I think this is more intuitive. Again, it follows the design of profiles and profile defaults, so it should be much easier to understand. Means that you can have
Hope this helps!
Comment on lines
+376
to
+380
| const auto themePair = window ? window.Theme() : nullptr; | ||
| if (!themePair) | ||
| { | ||
| return nullptr; | ||
| } |
Member
There was a problem hiding this comment.
Shouldn't we have a default theme?
| { | ||
| // Create this only on the first time we load the settings. | ||
| _terminalSettingsCache = std::make_shared<TerminalSettingsCache>(settings); | ||
| _terminalSettingsCache = std::make_shared<TerminalSettingsCache>(settings, settings.WindowSettings(_WindowProperties.WindowName())); |
Member
There was a problem hiding this comment.
Suggested change
| _terminalSettingsCache = std::make_shared<TerminalSettingsCache>(settings, settings.WindowSettings(_WindowProperties.WindowName())); | |
| _terminalSettingsCache = std::make_shared<TerminalSettingsCache>(settings, _currentWindowSettings()); |
nit: easier to read
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is part one of a two-part pair of PRs to add support for per window name settings to the Windows terminal.
This first PR functionally does very little. It introduces the concept of a
WindowSettingsobject, where eachWindowSettingsobject may be different based off of the name of the window. However, the settings model doesn't actually expose different instances ofWindowSettingscurrently. It just introduces one fake instance that actually just wraps the global settings object to store all of them. This means that functionally the code hasn't actually changed in this PR. We are just accessing these properties through an intermediate type.Largely this PR is mostly mechanical. where we previously would have been accessing properties on the
GlobalAppSettings, now we are just accessing the_currentWindowSettings()(via a helper, or passing as a parameter).All of this refactoring can be done now to always access the correct window settings object so that the next PR is much easier to read. That is where it will get more interesting and we will have more instances of window settings.
re: #9992