mirror of
https://github.com/microsoft/terminal.git
synced 2026-05-19 13:06:47 +00:00
Compare commits
3 Commits
dev/cazamo
...
user/migri
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d2edb0a1ba | ||
|
|
5b0e4b8acf | ||
|
|
d73b4e5022 |
@@ -1133,7 +1133,7 @@ namespace TerminalAppLocalTests
|
||||
// The Disabled tab switcher mode uses direct index-based switching
|
||||
// without the command palette, so it works in the test environment.
|
||||
Log::Comment(L"Change the tab switch order to not use the tab switcher (which is in-order always)");
|
||||
page->_settings.GlobalSettings().TabSwitcherMode(TabSwitcherMode::Disabled);
|
||||
page->_settings.WindowSettingsDefaults().TabSwitcherMode(TabSwitcherMode::Disabled);
|
||||
|
||||
Log::Comment(L"Switch to the next in-order tab: Tab[2]");
|
||||
TestOnUIThread([&page]() {
|
||||
|
||||
@@ -550,7 +550,7 @@ namespace winrt::TerminalApp::implementation
|
||||
if (const auto& realArgs = args.ActionArgs().try_as<CopyTextArgs>())
|
||||
{
|
||||
const auto copyFormatting = realArgs.CopyFormatting();
|
||||
const auto format = copyFormatting ? copyFormatting.Value() : _settings.GlobalSettings().CopyFormatting();
|
||||
const auto format = copyFormatting ? copyFormatting.Value() : _currentWindowSettings().CopyFormatting();
|
||||
const auto handled = _CopyText(realArgs.DismissSelection(), realArgs.SingleLine(), realArgs.WithControlSequences(), format);
|
||||
args.Handled(handled);
|
||||
}
|
||||
@@ -1118,7 +1118,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// use global default if query URL is unspecified
|
||||
if (queryUrl.empty())
|
||||
{
|
||||
queryUrl = std::wstring_view{ _settings.GlobalSettings().SearchWebDefaultQueryUrl() };
|
||||
queryUrl = std::wstring_view{ _currentWindowSettings().SearchWebDefaultQueryUrl() };
|
||||
}
|
||||
|
||||
constexpr std::wstring_view queryToken{ L"%s" };
|
||||
|
||||
@@ -194,7 +194,7 @@ namespace winrt::TerminalApp::implementation
|
||||
g_hTerminalAppProvider,
|
||||
"AppCreated",
|
||||
TraceLoggingDescription("Event emitted when the application is started"),
|
||||
TraceLoggingBool(_settings.GlobalSettings().ShowTabsInTitlebar(), "TabsInTitlebar"),
|
||||
TraceLoggingBool(_settings.WindowSettingsDefaults().ShowTabsInTitlebar(), "TabsInTitlebar"),
|
||||
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
|
||||
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
|
||||
}
|
||||
@@ -229,12 +229,12 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
|
||||
_hasSettingsStartupActions = false;
|
||||
const auto startupActions = newSettings.GlobalSettings().StartupActions();
|
||||
const auto startupActions = newSettings.WindowSettingsDefaults().StartupActions();
|
||||
if (!startupActions.empty())
|
||||
{
|
||||
_settingsAppArgs.FullResetState();
|
||||
|
||||
ExecuteCommandlineArgs args{ newSettings.GlobalSettings().StartupActions() };
|
||||
ExecuteCommandlineArgs args{ newSettings.WindowSettingsDefaults().StartupActions() };
|
||||
auto result = _settingsAppArgs.ParseArgs(args);
|
||||
if (result == 0)
|
||||
{
|
||||
|
||||
@@ -173,7 +173,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// Make sure to try/catch this, because the LocalTests won't be
|
||||
// able to use this helper.
|
||||
const auto settings{ winrt::TerminalApp::implementation::AppLogic::CurrentAppSettings() };
|
||||
if (settings.GlobalSettings().TabWidthMode() == winrt::Microsoft::UI::Xaml::Controls::TabViewWidthMode::SizeToContent)
|
||||
if (settings.WindowSettingsDefaults().TabWidthMode() == winrt::Microsoft::UI::Xaml::Controls::TabViewWidthMode::SizeToContent)
|
||||
{
|
||||
_headerControl.RenamerMaxWidth(HeaderRenameBoxWidthTitleLength);
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace winrt::TerminalApp::implementation
|
||||
if (insertPosition == -1)
|
||||
{
|
||||
insertPosition = _tabs.Size();
|
||||
if (_settings.GlobalSettings().NewTabPosition() == NewTabPosition::AfterCurrentTab)
|
||||
if (_currentWindowSettings().NewTabPosition() == NewTabPosition::AfterCurrentTab)
|
||||
{
|
||||
auto currentTabIndex = _GetFocusedTabIndex();
|
||||
if (currentTabIndex.has_value())
|
||||
@@ -231,7 +231,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - Handle changes to the tab width set by the user
|
||||
void TerminalPage::_UpdateTabWidthMode()
|
||||
{
|
||||
_tabView.TabWidthMode(_settings.GlobalSettings().TabWidthMode());
|
||||
_tabView.TabWidthMode(_currentWindowSettings().TabWidthMode());
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
@@ -244,9 +244,9 @@ namespace winrt::TerminalApp::implementation
|
||||
// - there is more than one tab, or the user has chosen to always show tabs
|
||||
const auto isVisible = !_isInFocusMode &&
|
||||
(!_isFullscreen || _showTabsFullscreen) &&
|
||||
(_settings.GlobalSettings().ShowTabsInTitlebar() ||
|
||||
(_currentWindowSettings().ShowTabsInTitlebar() ||
|
||||
(_tabs.Size() > 1) ||
|
||||
_settings.GlobalSettings().AlwaysShowTabs());
|
||||
_currentWindowSettings().AlwaysShowTabs());
|
||||
|
||||
if (_tabView)
|
||||
{
|
||||
@@ -286,7 +286,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// current control's live settings (which will include changes
|
||||
// made through VT).
|
||||
uint32_t insertPosition = _tabs.Size();
|
||||
if (_settings.GlobalSettings().NewTabPosition() == NewTabPosition::AfterCurrentTab)
|
||||
if (_currentWindowSettings().NewTabPosition() == NewTabPosition::AfterCurrentTab)
|
||||
{
|
||||
insertPosition = tab.TabViewIndex() + 1;
|
||||
}
|
||||
@@ -477,7 +477,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// 1. We want to customize this behavior (e.g., use MRU logic)
|
||||
// 2. In fullscreen (GH#5799) and focus (GH#7916) modes the _OnTabItemsChanged is not fired
|
||||
// 3. When rearranging tabs (GH#7916) _OnTabItemsChanged is suppressed
|
||||
const auto tabSwitchMode = _settings.GlobalSettings().TabSwitcherMode();
|
||||
const auto tabSwitchMode = _currentWindowSettings().TabSwitcherMode();
|
||||
|
||||
if (tabSwitchMode == TabSwitcherMode::MostRecentlyUsed)
|
||||
{
|
||||
@@ -528,7 +528,7 @@ namespace winrt::TerminalApp::implementation
|
||||
void TerminalPage::_SelectNextTab(const bool bMoveRight, const Windows::Foundation::IReference<Microsoft::Terminal::Settings::Model::TabSwitcherMode>& customTabSwitcherMode)
|
||||
{
|
||||
const auto index{ _GetFocusedTabIndex().value_or(0) };
|
||||
const auto tabSwitchMode = customTabSwitcherMode ? customTabSwitcherMode.Value() : _settings.GlobalSettings().TabSwitcherMode();
|
||||
const auto tabSwitchMode = customTabSwitcherMode ? customTabSwitcherMode.Value() : _currentWindowSettings().TabSwitcherMode();
|
||||
if (tabSwitchMode == TabSwitcherMode::Disabled)
|
||||
{
|
||||
auto tabCount = _tabs.Size();
|
||||
@@ -1017,7 +1017,7 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
void TerminalPage::_UpdateBackground(const winrt::Microsoft::Terminal::Settings::Model::Profile& profile)
|
||||
{
|
||||
if (profile && _settings.GlobalSettings().UseBackgroundImageForWindow())
|
||||
if (profile && _currentWindowSettings().UseBackgroundImageForWindow())
|
||||
{
|
||||
_SetBackgroundImage(profile.DefaultAppearance());
|
||||
}
|
||||
|
||||
@@ -293,6 +293,11 @@ namespace winrt::TerminalApp::implementation
|
||||
_systemRowsToScroll = _ReadSystemRowsToScroll();
|
||||
}
|
||||
|
||||
winrt::Microsoft::Terminal::Settings::Model::WindowSettings TerminalPage::_currentWindowSettings() const
|
||||
{
|
||||
return _settings.WindowSettings(_WindowProperties.WindowName());
|
||||
}
|
||||
|
||||
bool TerminalPage::IsRunningElevated() const noexcept
|
||||
{
|
||||
// GH#2455 - Make sure to try/catch calls to Application::Current,
|
||||
@@ -335,7 +340,7 @@ namespace winrt::TerminalApp::implementation
|
||||
auto tabRowImpl = winrt::get_self<implementation::TabRowControl>(_tabRow);
|
||||
_newTabButton = tabRowImpl->NewTabButton();
|
||||
|
||||
if (_settings.GlobalSettings().ShowTabsInTitlebar())
|
||||
if (_currentWindowSettings().ShowTabsInTitlebar())
|
||||
{
|
||||
// Remove the TabView from the page. We'll hang on to it, we need to
|
||||
// put it in the titlebar.
|
||||
@@ -425,7 +430,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// Settings AllowDependentAnimations will affect whether animations are
|
||||
// enabled application-wide, so we don't need to check it each time we
|
||||
// want to create an animation.
|
||||
WUX::Media::Animation::Timeline::AllowDependentAnimations(!_settings.GlobalSettings().DisableAnimations());
|
||||
WUX::Media::Animation::Timeline::AllowDependentAnimations(!_currentWindowSettings().DisableAnimations());
|
||||
|
||||
// Once the page is actually laid out on the screen, trigger all our
|
||||
// startup actions. Things like Panes need to know at least how big the
|
||||
@@ -434,14 +439,14 @@ namespace winrt::TerminalApp::implementation
|
||||
// _OnFirstLayout will remove this handler so it doesn't get called more than once.
|
||||
_layoutUpdatedRevoker = _tabContent.LayoutUpdated(winrt::auto_revoke, { this, &TerminalPage::_OnFirstLayout });
|
||||
|
||||
_isAlwaysOnTop = _settings.GlobalSettings().AlwaysOnTop();
|
||||
_showTabsFullscreen = _settings.GlobalSettings().ShowTabsFullscreen();
|
||||
_isAlwaysOnTop = _currentWindowSettings().AlwaysOnTop();
|
||||
_showTabsFullscreen = _currentWindowSettings().ShowTabsFullscreen();
|
||||
|
||||
// DON'T set up Toasts/TeachingTips here. They should be loaded and
|
||||
// initialized the first time they're opened, in whatever method opens
|
||||
// them.
|
||||
|
||||
_tabRow.ShowElevationShield(IsRunningElevated() && _settings.GlobalSettings().ShowAdminShield());
|
||||
_tabRow.ShowElevationShield(IsRunningElevated() && _currentWindowSettings().ShowAdminShield());
|
||||
|
||||
_adjustProcessPriorityThrottled = std::make_shared<ThrottledFunc<>>(
|
||||
DispatcherQueue::GetForCurrentThread(),
|
||||
@@ -951,7 +956,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// Create profile entries from the NewTabMenu configuration using a
|
||||
// recursive helper function. This returns a std::vector of FlyoutItemBases,
|
||||
// that we then add to our Flyout.
|
||||
auto entries = _settings.GlobalSettings().NewTabMenu();
|
||||
auto entries = _currentWindowSettings().NewTabMenu();
|
||||
auto items = _CreateNewTabFlyoutItems(entries);
|
||||
for (const auto& item : items)
|
||||
{
|
||||
@@ -1233,7 +1238,7 @@ namespace winrt::TerminalApp::implementation
|
||||
profileMenuItem.Icon(icon);
|
||||
}
|
||||
|
||||
if (profile.Guid() == _settings.GlobalSettings().DefaultProfile())
|
||||
if (profile.Guid() == _currentWindowSettings().DefaultProfile())
|
||||
{
|
||||
// Contrast the default profile with others in font weight.
|
||||
profileMenuItem.FontWeight(FontWeights::Bold());
|
||||
@@ -1470,7 +1475,7 @@ namespace winrt::TerminalApp::implementation
|
||||
const bool inheritCursor)
|
||||
{
|
||||
static const auto textMeasurement = [&]() -> std::wstring_view {
|
||||
switch (_settings.GlobalSettings().TextMeasurement())
|
||||
switch (_currentWindowSettings().TextMeasurement())
|
||||
{
|
||||
case TextMeasurement::Graphemes:
|
||||
return L"graphemes";
|
||||
@@ -1483,7 +1488,7 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
}();
|
||||
static const auto ambiguousIsWide = [&]() -> bool {
|
||||
return _settings.GlobalSettings().AmbiguousWidth() == AmbiguousWidth::Wide;
|
||||
return _currentWindowSettings().AmbiguousWidth() == AmbiguousWidth::Wide;
|
||||
}();
|
||||
|
||||
TerminalConnection::ITerminalConnection connection{ nullptr };
|
||||
@@ -2312,7 +2317,7 @@ namespace winrt::TerminalApp::implementation
|
||||
safe_void_coroutine TerminalPage::CloseWindow()
|
||||
{
|
||||
if (_HasMultipleTabs() &&
|
||||
_settings.GlobalSettings().ConfirmCloseAllTabs() &&
|
||||
_currentWindowSettings().ConfirmCloseAllTabs() &&
|
||||
!_displayingCloseDialog)
|
||||
{
|
||||
if (_newTabButton && _newTabButton.Flyout())
|
||||
@@ -2837,7 +2842,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - the title of the focused control if there is one, else "Terminal"
|
||||
hstring TerminalPage::Title()
|
||||
{
|
||||
if (_settings.GlobalSettings().ShowTitleInTitlebar())
|
||||
if (_currentWindowSettings().ShowTitleInTitlebar())
|
||||
{
|
||||
if (const auto tab{ _GetFocusedTab() })
|
||||
{
|
||||
@@ -2926,7 +2931,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - See Pane::CalcSnappedDimension
|
||||
float TerminalPage::CalcSnappedDimension(const bool widthOrHeight, const float dimension) const
|
||||
{
|
||||
if (_settings && _settings.GlobalSettings().SnapToGridOnResize())
|
||||
if (_settings && _currentWindowSettings().SnapToGridOnResize())
|
||||
{
|
||||
if (const auto tabImpl{ _GetFocusedTabImpl() })
|
||||
{
|
||||
@@ -2954,7 +2959,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// the WinRT one on average, depending on CPU load. Don't use the WinRT clipboard API if you can.
|
||||
const auto weakThis = get_weak();
|
||||
const auto dispatcher = Dispatcher();
|
||||
const auto globalSettings = _settings.GlobalSettings();
|
||||
const auto windowSettings = _currentWindowSettings();
|
||||
const auto bracketedPaste = eventArgs.BracketedPasteEnabled();
|
||||
const auto sourceId = sender.try_as<ControlInteractivity>().Id();
|
||||
|
||||
@@ -2967,7 +2972,7 @@ namespace winrt::TerminalApp::implementation
|
||||
text = clipboard::read();
|
||||
}
|
||||
|
||||
if (!bracketedPaste && globalSettings.TrimPaste())
|
||||
if (!bracketedPaste && windowSettings.TrimPaste())
|
||||
{
|
||||
text = winrt::hstring{ Utils::TrimPaste(text) };
|
||||
}
|
||||
@@ -2982,7 +2987,7 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
|
||||
bool warnMultiLine = false;
|
||||
switch (globalSettings.WarnAboutMultiLinePaste())
|
||||
switch (windowSettings.WarnAboutMultiLinePaste())
|
||||
{
|
||||
case WarnAboutMultiLinePaste::Automatic:
|
||||
// NOTE that this is unsafe, because a shell that doesn't support bracketed paste
|
||||
@@ -3005,7 +3010,7 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
|
||||
constexpr std::size_t minimumSizeForWarning = 1024 * 5; // 5 KiB
|
||||
const auto warnLargeText = text.size() > minimumSizeForWarning && globalSettings.WarnAboutLargePaste();
|
||||
const auto warnLargeText = text.size() > minimumSizeForWarning && windowSettings.WarnAboutLargePaste();
|
||||
|
||||
if (warnMultiLine || warnLargeText)
|
||||
{
|
||||
@@ -3813,7 +3818,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - <none>
|
||||
void TerminalPage::_SetBackgroundImage(const winrt::Microsoft::Terminal::Settings::Model::IAppearanceConfig& newAppearance)
|
||||
{
|
||||
if (!_settings.GlobalSettings().UseBackgroundImageForWindow())
|
||||
if (!_currentWindowSettings().UseBackgroundImageForWindow())
|
||||
{
|
||||
_tabContent.Background(nullptr);
|
||||
return;
|
||||
@@ -3922,17 +3927,17 @@ namespace winrt::TerminalApp::implementation
|
||||
// Reload the current value of alwaysOnTop from the settings file. This
|
||||
// will let the user hot-reload this setting, but any runtime changes to
|
||||
// the alwaysOnTop setting will be lost.
|
||||
_isAlwaysOnTop = _settings.GlobalSettings().AlwaysOnTop();
|
||||
_isAlwaysOnTop = _currentWindowSettings().AlwaysOnTop();
|
||||
AlwaysOnTopChanged.raise(*this, nullptr);
|
||||
|
||||
_showTabsFullscreen = _settings.GlobalSettings().ShowTabsFullscreen();
|
||||
_showTabsFullscreen = _currentWindowSettings().ShowTabsFullscreen();
|
||||
|
||||
// Settings AllowDependentAnimations will affect whether animations are
|
||||
// enabled application-wide, so we don't need to check it each time we
|
||||
// want to create an animation.
|
||||
WUX::Media::Animation::Timeline::AllowDependentAnimations(!_settings.GlobalSettings().DisableAnimations());
|
||||
WUX::Media::Animation::Timeline::AllowDependentAnimations(!_currentWindowSettings().DisableAnimations());
|
||||
|
||||
_tabRow.ShowElevationShield(IsRunningElevated() && _settings.GlobalSettings().ShowAdminShield());
|
||||
_tabRow.ShowElevationShield(IsRunningElevated() && _currentWindowSettings().ShowAdminShield());
|
||||
|
||||
Media::SolidColorBrush transparent{ Windows::UI::Colors::Transparent() };
|
||||
_tabView.Background(transparent);
|
||||
@@ -4720,7 +4725,7 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
if (profile == _settings.ProfileDefaults())
|
||||
{
|
||||
return _settings.FindProfile(_settings.GlobalSettings().DefaultProfile());
|
||||
return _settings.FindProfile(_currentWindowSettings().DefaultProfile());
|
||||
}
|
||||
return profile;
|
||||
}
|
||||
@@ -4985,7 +4990,7 @@ namespace winrt::TerminalApp::implementation
|
||||
theme.TabRow().UnfocusedBackground()) :
|
||||
ThemeColor{ nullptr } };
|
||||
|
||||
if (_settings.GlobalSettings().UseAcrylicInTabRow() && (_activated || _settings.GlobalSettings().EnableUnfocusedAcrylic()))
|
||||
if (_currentWindowSettings().UseAcrylicInTabRow() && (_activated || _currentWindowSettings().EnableUnfocusedAcrylic()))
|
||||
{
|
||||
if (tabRowBg)
|
||||
{
|
||||
@@ -5015,7 +5020,7 @@ namespace winrt::TerminalApp::implementation
|
||||
TitlebarBrush(backgroundSolidBrush);
|
||||
}
|
||||
|
||||
if (!_settings.GlobalSettings().ShowTabsInTitlebar())
|
||||
if (!_currentWindowSettings().ShowTabsInTitlebar())
|
||||
{
|
||||
_tabRow.Background(TitlebarBrush());
|
||||
}
|
||||
@@ -5251,7 +5256,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// Feature_ShellCompletions::IsEnabled back in _RegisterTerminalEvents
|
||||
|
||||
// User must explicitly opt-in on Preview builds
|
||||
if (!_settings.GlobalSettings().EnableShellCompletionMenu())
|
||||
if (!_currentWindowSettings().EnableShellCompletionMenu())
|
||||
{
|
||||
co_return;
|
||||
}
|
||||
|
||||
@@ -283,6 +283,8 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
TerminalApp::ContentManager _manager{ nullptr };
|
||||
|
||||
Microsoft::Terminal::Settings::Model::WindowSettings _currentWindowSettings() const;
|
||||
|
||||
std::shared_ptr<TerminalSettingsCache> _terminalSettingsCache{};
|
||||
|
||||
struct StashedDragData
|
||||
|
||||
@@ -267,22 +267,22 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
bool TerminalWindow::GetShowTabsInTitlebar()
|
||||
{
|
||||
return _settings.GlobalSettings().ShowTabsInTitlebar();
|
||||
return _settings.WindowSettingsDefaults().ShowTabsInTitlebar();
|
||||
}
|
||||
|
||||
bool TerminalWindow::GetInitialAlwaysOnTop()
|
||||
{
|
||||
return _settings.GlobalSettings().AlwaysOnTop();
|
||||
return _settings.WindowSettingsDefaults().AlwaysOnTop();
|
||||
}
|
||||
|
||||
bool TerminalWindow::GetInitialShowTabsFullscreen()
|
||||
{
|
||||
return _settings.GlobalSettings().ShowTabsFullscreen();
|
||||
return _settings.WindowSettingsDefaults().ShowTabsFullscreen();
|
||||
}
|
||||
|
||||
bool TerminalWindow::GetMinimizeToNotificationArea()
|
||||
{
|
||||
return _settings.GlobalSettings().MinimizeToNotificationArea();
|
||||
return _settings.WindowSettingsDefaults().MinimizeToNotificationArea();
|
||||
}
|
||||
|
||||
bool TerminalWindow::GetAlwaysShowNotificationIcon()
|
||||
@@ -292,7 +292,7 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
bool TerminalWindow::GetShowTitleInTitlebar()
|
||||
{
|
||||
return _settings.GlobalSettings().ShowTitleInTitlebar();
|
||||
return _settings.WindowSettingsDefaults().ShowTitleInTitlebar();
|
||||
}
|
||||
|
||||
Microsoft::Terminal::Settings::Model::Theme TerminalWindow::Theme()
|
||||
@@ -598,7 +598,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// --focusMode on the commandline here, and the mode in the settings.
|
||||
// Below, we'll also account for if focus mode was persisted into the
|
||||
// session for restoration.
|
||||
bool focusMode = _appArgs && _appArgs->ParsedArgs().GetLaunchMode().value_or(_settings.GlobalSettings().LaunchMode()) == LaunchMode::FocusMode;
|
||||
bool focusMode = _appArgs && _appArgs->ParsedArgs().GetLaunchMode().value_or(_settings.WindowSettingsDefaults().LaunchMode()) == LaunchMode::FocusMode;
|
||||
|
||||
const auto scale = static_cast<float>(dpi) / static_cast<float>(USER_DEFAULT_SCREEN_DPI);
|
||||
if (const auto layout = LoadPersistedLayout())
|
||||
@@ -645,7 +645,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// GH#2061 - If the global setting "Always show tab bar" is
|
||||
// set or if "Show tabs in title bar" is set, then we'll need to add
|
||||
// the height of the tab bar here.
|
||||
if (_settings.GlobalSettings().ShowTabsInTitlebar() && !focusMode)
|
||||
if (_settings.WindowSettingsDefaults().ShowTabsInTitlebar() && !focusMode)
|
||||
{
|
||||
// In the past, we used to actually instantiate a TitlebarControl
|
||||
// and use Measure() to determine the DesiredSize of the control, to
|
||||
@@ -663,7 +663,7 @@ namespace winrt::TerminalApp::implementation
|
||||
static constexpr auto titlebarHeight = 40;
|
||||
proposedSize.Height += (titlebarHeight)*scale;
|
||||
}
|
||||
else if (_settings.GlobalSettings().AlwaysShowTabs() && !focusMode)
|
||||
else if (_settings.WindowSettingsDefaults().AlwaysShowTabs() && !focusMode)
|
||||
{
|
||||
// Same comment as above, but with a TabRowControl.
|
||||
//
|
||||
@@ -696,7 +696,7 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
// GH#4620/#5801 - If the user passed --maximized or --fullscreen on the
|
||||
// commandline, then use that to override the value from the settings.
|
||||
const auto valueFromSettings = _settings.GlobalSettings().LaunchMode();
|
||||
const auto valueFromSettings = _settings.WindowSettingsDefaults().LaunchMode();
|
||||
const auto valueFromCommandlineArgs = _appArgs ? _appArgs->ParsedArgs().GetLaunchMode() : std::nullopt;
|
||||
if (const auto layout = LoadPersistedLayout())
|
||||
{
|
||||
@@ -722,7 +722,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - a point containing the requested initial position in pixels.
|
||||
TerminalApp::InitialPosition TerminalWindow::GetInitialPosition(int64_t defaultInitialX, int64_t defaultInitialY)
|
||||
{
|
||||
auto initialPosition{ _settings.GlobalSettings().InitialPosition() };
|
||||
auto initialPosition{ _settings.WindowSettingsDefaults().InitialPosition() };
|
||||
|
||||
if (const auto layout = LoadPersistedLayout())
|
||||
{
|
||||
@@ -770,7 +770,7 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
return !_contentBounds &&
|
||||
!hadPersistedPosition &&
|
||||
_settings.GlobalSettings().CenterOnLaunch() &&
|
||||
_settings.WindowSettingsDefaults().CenterOnLaunch() &&
|
||||
(_appArgs && !_appArgs->ParsedArgs().GetPosition().has_value());
|
||||
}
|
||||
|
||||
@@ -1188,7 +1188,7 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
bool TerminalWindow::AutoHideWindow()
|
||||
{
|
||||
return _settings.GlobalSettings().AutoHideWindow();
|
||||
return _settings.WindowSettingsDefaults().AutoHideWindow();
|
||||
}
|
||||
|
||||
void TerminalWindow::UpdateSettingsHandler(const winrt::IInspectable& /*sender*/,
|
||||
@@ -1332,13 +1332,13 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
if (!FocusMode())
|
||||
{
|
||||
if (!_settings.GlobalSettings().AlwaysShowTabs())
|
||||
if (!_settings.WindowSettingsDefaults().AlwaysShowTabs())
|
||||
{
|
||||
// Hide the title bar = off, Always show tabs = off.
|
||||
static constexpr auto titlebarHeight = 10;
|
||||
pixelSize.Height += (titlebarHeight)*scale;
|
||||
}
|
||||
else if (!_settings.GlobalSettings().ShowTabsInTitlebar())
|
||||
else if (!_settings.WindowSettingsDefaults().ShowTabsInTitlebar())
|
||||
{
|
||||
// Hide the title bar = off, Always show tabs = on.
|
||||
static constexpr auto titlebarAndTabBarHeight = 40;
|
||||
|
||||
@@ -55,8 +55,9 @@ namespace winrt::Microsoft::Terminal::Settings
|
||||
auto settings{ winrt::make_self<TerminalSettings>() };
|
||||
|
||||
const auto globals = appSettings.GlobalSettings();
|
||||
const auto windowSettings = appSettings.WindowSettingsDefaults();
|
||||
settings->_ApplyProfileSettings(profile);
|
||||
settings->_ApplyGlobalSettings(globals);
|
||||
settings->_ApplyGlobalSettings(windowSettings);
|
||||
settings->_ApplyAppearanceSettings(profile.DefaultAppearance(), globals.ColorSchemes(), globals.CurrentTheme());
|
||||
|
||||
return settings;
|
||||
@@ -362,27 +363,27 @@ namespace winrt::Microsoft::Terminal::Settings
|
||||
// - globalSettings: the global property values we're applying.
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void TerminalSettings::_ApplyGlobalSettings(const Model::GlobalAppSettings& globalSettings) noexcept
|
||||
void TerminalSettings::_ApplyGlobalSettings(const Model::WindowSettings& windowSettings) noexcept
|
||||
{
|
||||
_InitialRows = globalSettings.InitialRows();
|
||||
_InitialCols = globalSettings.InitialCols();
|
||||
_InitialRows = windowSettings.InitialRows();
|
||||
_InitialCols = windowSettings.InitialCols();
|
||||
|
||||
_WordDelimiters = globalSettings.WordDelimiters();
|
||||
_CopyOnSelect = globalSettings.CopyOnSelect();
|
||||
_CopyFormatting = globalSettings.CopyFormatting();
|
||||
_FocusFollowMouse = globalSettings.FocusFollowMouse();
|
||||
_ScrollToZoom = globalSettings.ScrollToZoom();
|
||||
_ScrollToChangeOpacity = globalSettings.ScrollToChangeOpacity();
|
||||
_GraphicsAPI = globalSettings.GraphicsAPI();
|
||||
_DisablePartialInvalidation = globalSettings.DisablePartialInvalidation();
|
||||
_SoftwareRendering = globalSettings.SoftwareRendering();
|
||||
_TextMeasurement = globalSettings.TextMeasurement();
|
||||
_AmbiguousWidth = globalSettings.AmbiguousWidth();
|
||||
_DefaultInputScope = globalSettings.DefaultInputScope();
|
||||
_UseBackgroundImageForWindow = globalSettings.UseBackgroundImageForWindow();
|
||||
_TrimBlockSelection = globalSettings.TrimBlockSelection();
|
||||
_DetectURLs = globalSettings.DetectURLs();
|
||||
_EnableUnfocusedAcrylic = globalSettings.EnableUnfocusedAcrylic();
|
||||
_WordDelimiters = windowSettings.WordDelimiters();
|
||||
_CopyOnSelect = windowSettings.CopyOnSelect();
|
||||
_CopyFormatting = windowSettings.CopyFormatting();
|
||||
_FocusFollowMouse = windowSettings.FocusFollowMouse();
|
||||
_ScrollToZoom = windowSettings.ScrollToZoom();
|
||||
_ScrollToChangeOpacity = windowSettings.ScrollToChangeOpacity();
|
||||
_GraphicsAPI = windowSettings.GraphicsAPI();
|
||||
_DisablePartialInvalidation = windowSettings.DisablePartialInvalidation();
|
||||
_SoftwareRendering = windowSettings.SoftwareRendering();
|
||||
_TextMeasurement = windowSettings.TextMeasurement();
|
||||
_AmbiguousWidth = windowSettings.AmbiguousWidth();
|
||||
_DefaultInputScope = windowSettings.DefaultInputScope();
|
||||
_UseBackgroundImageForWindow = windowSettings.UseBackgroundImageForWindow();
|
||||
_TrimBlockSelection = windowSettings.TrimBlockSelection();
|
||||
_DetectURLs = windowSettings.DetectURLs();
|
||||
_EnableUnfocusedAcrylic = windowSettings.EnableUnfocusedAcrylic();
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace winrt::Microsoft::Terminal::Settings
|
||||
static winrt::com_ptr<TerminalSettings> _CreateWithProfileCommon(const Model::CascadiaSettings& appSettings, const Model::Profile& profile);
|
||||
void _ApplyProfileSettings(const Model::Profile& profile);
|
||||
|
||||
void _ApplyGlobalSettings(const Model::GlobalAppSettings& globalSettings) noexcept;
|
||||
void _ApplyGlobalSettings(const Model::WindowSettings& windowSettings) noexcept;
|
||||
void _ApplyAppearanceSettings(const Microsoft::Terminal::Settings::Model::IAppearanceConfig& appearance,
|
||||
const Windows::Foundation::Collections::IMapView<hstring, Microsoft::Terminal::Settings::Model::ColorScheme>& schemes,
|
||||
const winrt::Microsoft::Terminal::Settings::Model::Theme currentTheme);
|
||||
|
||||
@@ -25,8 +25,8 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_settings.GlobalSettings(), AllowHeadless);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_settings.GlobalSettings(), DebugFeaturesEnabled);
|
||||
GETSET_BINDABLE_ENUM_SETTING(TextMeasurement, winrt::Microsoft::Terminal::Control::TextMeasurement, _settings.GlobalSettings().TextMeasurement);
|
||||
GETSET_BINDABLE_ENUM_SETTING(AmbiguousWidth, winrt::Microsoft::Terminal::Control::AmbiguousWidth, _settings.GlobalSettings().AmbiguousWidth);
|
||||
GETSET_BINDABLE_ENUM_SETTING(TextMeasurement, winrt::Microsoft::Terminal::Control::TextMeasurement, _settings.WindowSettingsDefaults().TextMeasurement);
|
||||
GETSET_BINDABLE_ENUM_SETTING(AmbiguousWidth, winrt::Microsoft::Terminal::Control::AmbiguousWidth, _settings.WindowSettingsDefaults().AmbiguousWidth);
|
||||
|
||||
private:
|
||||
Model::CascadiaSettings _settings;
|
||||
|
||||
@@ -22,8 +22,9 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
constexpr std::wstring_view legacyDarkThemeName{ L"legacyDark" };
|
||||
constexpr std::wstring_view legacyLightThemeName{ L"legacyLight" };
|
||||
|
||||
GlobalAppearanceViewModel::GlobalAppearanceViewModel(Model::GlobalAppSettings globalSettings) :
|
||||
GlobalAppearanceViewModel::GlobalAppearanceViewModel(Model::GlobalAppSettings globalSettings, Model::WindowSettings windowSettings) :
|
||||
_GlobalSettings{ globalSettings },
|
||||
_WindowSettings{ windowSettings },
|
||||
_ThemeList{ single_threaded_observable_vector<Model::Theme>() }
|
||||
{
|
||||
INITIALIZE_BINDABLE_ENUM_SETTING(NewTabPosition, NewTabPosition, NewTabPosition, L"Globals_NewTabPosition", L"Content");
|
||||
@@ -56,7 +57,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
{
|
||||
if (const auto& theme{ tag.try_as<Model::Theme>() })
|
||||
{
|
||||
_GlobalSettings.Theme(Model::ThemePair{ theme.Name() });
|
||||
_WindowSettings.Theme(Model::ThemePair{ theme.Name() });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,12 +104,12 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
|
||||
bool GlobalAppearanceViewModel::InvertedDisableAnimations()
|
||||
{
|
||||
return !_GlobalSettings.DisableAnimations();
|
||||
return !_WindowSettings.DisableAnimations();
|
||||
}
|
||||
|
||||
void GlobalAppearanceViewModel::InvertedDisableAnimations(bool value)
|
||||
{
|
||||
_GlobalSettings.DisableAnimations(!value);
|
||||
_WindowSettings.DisableAnimations(!value);
|
||||
}
|
||||
|
||||
void GlobalAppearanceViewModel::ShowTitlebarToggled(const winrt::Windows::Foundation::IInspectable& /* sender */, const RoutedEventArgs& /* args */)
|
||||
|
||||
@@ -12,14 +12,14 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
struct GlobalAppearanceViewModel : GlobalAppearanceViewModelT<GlobalAppearanceViewModel>, ViewModelHelper<GlobalAppearanceViewModel>
|
||||
{
|
||||
public:
|
||||
GlobalAppearanceViewModel(Model::GlobalAppSettings globalSettings);
|
||||
GlobalAppearanceViewModel(Model::GlobalAppSettings globalSettings, Model::WindowSettings windowSettings);
|
||||
|
||||
// DON'T YOU DARE ADD A `WINRT_CALLBACK(PropertyChanged` TO A CLASS DERIVED FROM ViewModelHelper. Do this instead:
|
||||
using ViewModelHelper<GlobalAppearanceViewModel>::PropertyChanged;
|
||||
|
||||
WINRT_PROPERTY(Windows::Foundation::Collections::IObservableVector<Model::Theme>, ThemeList, nullptr);
|
||||
GETSET_BINDABLE_ENUM_SETTING(NewTabPosition, Model::NewTabPosition, _GlobalSettings.NewTabPosition);
|
||||
GETSET_BINDABLE_ENUM_SETTING(TabWidthMode, winrt::Microsoft::UI::Xaml::Controls::TabViewWidthMode, _GlobalSettings.TabWidthMode);
|
||||
GETSET_BINDABLE_ENUM_SETTING(NewTabPosition, Model::NewTabPosition, _WindowSettings.NewTabPosition);
|
||||
GETSET_BINDABLE_ENUM_SETTING(TabWidthMode, winrt::Microsoft::UI::Xaml::Controls::TabViewWidthMode, _WindowSettings.TabWidthMode);
|
||||
|
||||
public:
|
||||
winrt::Windows::Foundation::IInspectable CurrentTheme();
|
||||
@@ -31,20 +31,21 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
|
||||
void ShowTitlebarToggled(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::UI::Xaml::RoutedEventArgs& args);
|
||||
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, AlwaysShowTabs);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, ShowTabsFullscreen);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, ShowTabsInTitlebar);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, UseAcrylicInTabRow);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, ShowTitleInTitlebar);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, AlwaysOnTop);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, AutoHideWindow);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_WindowSettings, AlwaysShowTabs);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_WindowSettings, ShowTabsFullscreen);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_WindowSettings, ShowTabsInTitlebar);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_WindowSettings, UseAcrylicInTabRow);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_WindowSettings, ShowTitleInTitlebar);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_WindowSettings, AlwaysOnTop);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_WindowSettings, AutoHideWindow);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, AlwaysShowNotificationIcon);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, MinimizeToNotificationArea);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, ShowAdminShield);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, EnableUnfocusedAcrylic);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_WindowSettings, MinimizeToNotificationArea);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_WindowSettings, ShowAdminShield);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_WindowSettings, EnableUnfocusedAcrylic);
|
||||
|
||||
private:
|
||||
Model::GlobalAppSettings _GlobalSettings;
|
||||
Model::WindowSettings _WindowSettings;
|
||||
winrt::Windows::Foundation::IInspectable _currentTheme;
|
||||
|
||||
void _UpdateThemeList();
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace Microsoft.Terminal.Settings.Editor
|
||||
{
|
||||
runtimeclass GlobalAppearanceViewModel : Windows.UI.Xaml.Data.INotifyPropertyChanged
|
||||
{
|
||||
GlobalAppearanceViewModel(Microsoft.Terminal.Settings.Model.GlobalAppSettings globalSettings);
|
||||
GlobalAppearanceViewModel(Microsoft.Terminal.Settings.Model.GlobalAppSettings globalSettings, Microsoft.Terminal.Settings.Model.WindowSettings windowSettings);
|
||||
|
||||
IInspectable CurrentTheme;
|
||||
static String ThemeNameConverter(Microsoft.Terminal.Settings.Model.Theme theme);
|
||||
|
||||
@@ -12,8 +12,9 @@ using namespace winrt::Microsoft::Terminal::Settings::Model;
|
||||
|
||||
namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
{
|
||||
InteractionViewModel::InteractionViewModel(Model::GlobalAppSettings globalSettings) :
|
||||
_GlobalSettings{ globalSettings }
|
||||
InteractionViewModel::InteractionViewModel(Model::GlobalAppSettings globalSettings, Model::WindowSettings windowSettings) :
|
||||
_GlobalSettings{ globalSettings },
|
||||
_WindowSettings{ windowSettings }
|
||||
{
|
||||
INITIALIZE_BINDABLE_ENUM_SETTING(TabSwitcherMode, TabSwitcherMode, TabSwitcherMode, L"Globals_TabSwitcherMode", L"Content");
|
||||
INITIALIZE_BINDABLE_ENUM_SETTING(CopyFormat, CopyFormat, winrt::Microsoft::Terminal::Control::CopyFormat, L"Globals_CopyFormat", L"Content");
|
||||
|
||||
@@ -12,32 +12,33 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
struct InteractionViewModel : InteractionViewModelT<InteractionViewModel>, ViewModelHelper<InteractionViewModel>
|
||||
{
|
||||
public:
|
||||
InteractionViewModel(Model::GlobalAppSettings globalSettings);
|
||||
InteractionViewModel(Model::GlobalAppSettings globalSettings, Model::WindowSettings windowSettings);
|
||||
|
||||
// DON'T YOU DARE ADD A `WINRT_CALLBACK(PropertyChanged` TO A CLASS DERIVED FROM ViewModelHelper. Do this instead:
|
||||
using ViewModelHelper<InteractionViewModel>::PropertyChanged;
|
||||
|
||||
GETSET_BINDABLE_ENUM_SETTING(TabSwitcherMode, Model::TabSwitcherMode, _GlobalSettings.TabSwitcherMode);
|
||||
GETSET_BINDABLE_ENUM_SETTING(CopyFormat, winrt::Microsoft::Terminal::Control::CopyFormat, _GlobalSettings.CopyFormatting);
|
||||
GETSET_BINDABLE_ENUM_SETTING(TabSwitcherMode, Model::TabSwitcherMode, _WindowSettings.TabSwitcherMode);
|
||||
GETSET_BINDABLE_ENUM_SETTING(CopyFormat, winrt::Microsoft::Terminal::Control::CopyFormat, _WindowSettings.CopyFormatting);
|
||||
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, CopyOnSelect);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, TrimBlockSelection);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, TrimPaste);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, SnapToGridOnResize);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, FocusFollowMouse);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, ScrollToZoom);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, ScrollToChangeOpacity);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, DetectURLs);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, SearchWebDefaultQueryUrl);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, WordDelimiters);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, ConfirmCloseAllTabs);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_WindowSettings, CopyOnSelect);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_WindowSettings, TrimBlockSelection);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_WindowSettings, TrimPaste);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_WindowSettings, SnapToGridOnResize);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_WindowSettings, FocusFollowMouse);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_WindowSettings, ScrollToZoom);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_WindowSettings, ScrollToChangeOpacity);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_WindowSettings, DetectURLs);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_WindowSettings, SearchWebDefaultQueryUrl);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_WindowSettings, WordDelimiters);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_WindowSettings, ConfirmCloseAllTabs);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, InputServiceWarning);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, WarnAboutLargePaste);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, WarnAboutMultiLinePaste);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_WindowSettings, WarnAboutLargePaste);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_WindowSettings, WarnAboutMultiLinePaste);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, EnableColorSelection);
|
||||
|
||||
private:
|
||||
Model::GlobalAppSettings _GlobalSettings;
|
||||
Model::WindowSettings _WindowSettings;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace Microsoft.Terminal.Settings.Editor
|
||||
{
|
||||
runtimeclass InteractionViewModel : Windows.UI.Xaml.Data.INotifyPropertyChanged
|
||||
{
|
||||
InteractionViewModel(Microsoft.Terminal.Settings.Model.GlobalAppSettings globalSettings);
|
||||
InteractionViewModel(Microsoft.Terminal.Settings.Model.GlobalAppSettings globalSettings, Microsoft.Terminal.Settings.Model.WindowSettings windowSettings);
|
||||
|
||||
IInspectable CurrentTabSwitcherMode;
|
||||
Windows.Foundation.Collections.IObservableVector<Microsoft.Terminal.Settings.Editor.EnumEntry> TabSwitcherModeList { get; };
|
||||
|
||||
@@ -231,7 +231,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
|
||||
double LaunchViewModel::InitialPosX()
|
||||
{
|
||||
const auto x = _Settings.GlobalSettings().InitialPosition().X;
|
||||
const auto x = _Settings.WindowSettingsDefaults().InitialPosition().X;
|
||||
// If there's no value here, return NAN - XAML will ignore it and
|
||||
// put the placeholder text in the box instead
|
||||
const auto xCoord = x.try_as<int32_t>();
|
||||
@@ -240,7 +240,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
|
||||
double LaunchViewModel::InitialPosY()
|
||||
{
|
||||
const auto y = _Settings.GlobalSettings().InitialPosition().Y;
|
||||
const auto y = _Settings.WindowSettingsDefaults().InitialPosition().Y;
|
||||
// If there's no value here, return NAN - XAML will ignore it and
|
||||
// put the placeholder text in the box instead
|
||||
const auto yCoord = y.try_as<int32_t>();
|
||||
@@ -255,8 +255,8 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
{
|
||||
xCoordRef = gsl::narrow_cast<int32_t>(xCoord);
|
||||
}
|
||||
const LaunchPosition newPos{ xCoordRef, _Settings.GlobalSettings().InitialPosition().Y };
|
||||
_Settings.GlobalSettings().InitialPosition(newPos);
|
||||
const LaunchPosition newPos{ xCoordRef, _Settings.WindowSettingsDefaults().InitialPosition().Y };
|
||||
_Settings.WindowSettingsDefaults().InitialPosition(newPos);
|
||||
_NotifyChanges(L"LaunchParametersCurrentValue");
|
||||
}
|
||||
|
||||
@@ -268,8 +268,8 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
{
|
||||
yCoordRef = gsl::narrow_cast<int32_t>(yCoord);
|
||||
}
|
||||
const LaunchPosition newPos{ _Settings.GlobalSettings().InitialPosition().X, yCoordRef };
|
||||
_Settings.GlobalSettings().InitialPosition(newPos);
|
||||
const LaunchPosition newPos{ _Settings.WindowSettingsDefaults().InitialPosition().X, yCoordRef };
|
||||
_Settings.WindowSettingsDefaults().InitialPosition(newPos);
|
||||
_NotifyChanges(L"LaunchParametersCurrentValue");
|
||||
}
|
||||
|
||||
@@ -291,7 +291,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
|
||||
winrt::Windows::Foundation::IInspectable LaunchViewModel::CurrentLaunchMode()
|
||||
{
|
||||
return winrt::box_value<winrt::Microsoft::Terminal::Settings::Editor::EnumEntry>(_LaunchModeMap.Lookup(_Settings.GlobalSettings().LaunchMode()));
|
||||
return winrt::box_value<winrt::Microsoft::Terminal::Settings::Editor::EnumEntry>(_LaunchModeMap.Lookup(_Settings.WindowSettingsDefaults().LaunchMode()));
|
||||
}
|
||||
|
||||
void LaunchViewModel::CurrentLaunchMode(const winrt::Windows::Foundation::IInspectable& enumEntry)
|
||||
@@ -299,7 +299,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
if (const auto ee = enumEntry.try_as<winrt::Microsoft::Terminal::Settings::Editor::EnumEntry>())
|
||||
{
|
||||
const auto setting = winrt::unbox_value<LaunchMode>(ee.EnumValue());
|
||||
_Settings.GlobalSettings().LaunchMode(setting);
|
||||
_Settings.WindowSettingsDefaults().LaunchMode(setting);
|
||||
_NotifyChanges(L"LaunchParametersCurrentValue");
|
||||
}
|
||||
}
|
||||
@@ -311,14 +311,14 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
|
||||
winrt::Windows::Foundation::IInspectable LaunchViewModel::CurrentDefaultProfile()
|
||||
{
|
||||
const auto defaultProfileGuid{ _Settings.GlobalSettings().DefaultProfile() };
|
||||
const auto defaultProfileGuid{ _Settings.WindowSettingsDefaults().DefaultProfile() };
|
||||
return winrt::box_value(_Settings.FindProfile(defaultProfileGuid));
|
||||
}
|
||||
|
||||
void LaunchViewModel::CurrentDefaultProfile(const IInspectable& value)
|
||||
{
|
||||
const auto profile{ winrt::unbox_value<Model::Profile>(value) };
|
||||
_Settings.GlobalSettings().DefaultProfile(profile.Guid());
|
||||
_Settings.WindowSettingsDefaults().DefaultProfile(profile.Guid());
|
||||
}
|
||||
|
||||
winrt::Windows::Foundation::Collections::IObservableVector<Model::Profile> LaunchViewModel::DefaultProfiles() const
|
||||
|
||||
@@ -46,13 +46,13 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
void CurrentLaunchMode(const winrt::Windows::Foundation::IInspectable& enumEntry);
|
||||
winrt::Windows::Foundation::Collections::IObservableVector<winrt::Microsoft::Terminal::Settings::Editor::EnumEntry> LaunchModeList();
|
||||
|
||||
GETSET_BINDABLE_ENUM_SETTING(DefaultInputScope, winrt::Microsoft::Terminal::Control::DefaultInputScope, _Settings.GlobalSettings().DefaultInputScope);
|
||||
GETSET_BINDABLE_ENUM_SETTING(DefaultInputScope, winrt::Microsoft::Terminal::Control::DefaultInputScope, _Settings.WindowSettingsDefaults().DefaultInputScope);
|
||||
GETSET_BINDABLE_ENUM_SETTING(FirstWindowPreference, Model::FirstWindowPreference, _Settings.GlobalSettings().FirstWindowPreference);
|
||||
GETSET_BINDABLE_ENUM_SETTING(WindowingBehavior, Model::WindowingMode, _Settings.GlobalSettings().WindowingBehavior);
|
||||
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_Settings.GlobalSettings(), CenterOnLaunch);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_Settings.GlobalSettings(), InitialRows);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_Settings.GlobalSettings(), InitialCols);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_Settings.WindowSettingsDefaults(), CenterOnLaunch);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_Settings.WindowSettingsDefaults(), InitialRows);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_Settings.WindowSettingsDefaults(), InitialCols);
|
||||
|
||||
bool StartOnUserLoginAvailable();
|
||||
safe_void_coroutine PrepareStartOnUserLoginSettings();
|
||||
|
||||
@@ -551,7 +551,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
}
|
||||
else if (*clickedItemTag == interactionTag)
|
||||
{
|
||||
contentFrame().Navigate(xaml_typename<Editor::Interaction>(), winrt::make<NavigateToPageArgs>(winrt::make<InteractionViewModel>(_settingsClone.GlobalSettings()), *this, elementToFocus));
|
||||
contentFrame().Navigate(xaml_typename<Editor::Interaction>(), winrt::make<NavigateToPageArgs>(winrt::make<InteractionViewModel>(_settingsClone.GlobalSettings(), _settingsClone.WindowSettingsDefaults()), *this, elementToFocus));
|
||||
_breadcrumbs.Append(winrt::make<Breadcrumb>(vm, RS_(L"Nav_Interaction/Content"), BreadcrumbSubPage::None));
|
||||
}
|
||||
else if (*clickedItemTag == renderingTag)
|
||||
@@ -649,7 +649,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
}
|
||||
else if (*clickedItemTag == globalAppearanceTag)
|
||||
{
|
||||
contentFrame().Navigate(xaml_typename<Editor::GlobalAppearance>(), winrt::make<NavigateToPageArgs>(winrt::make<GlobalAppearanceViewModel>(_settingsClone.GlobalSettings()), *this, elementToFocus));
|
||||
contentFrame().Navigate(xaml_typename<Editor::GlobalAppearance>(), winrt::make<NavigateToPageArgs>(winrt::make<GlobalAppearanceViewModel>(_settingsClone.GlobalSettings(), _settingsClone.WindowSettingsDefaults()), *this, elementToFocus));
|
||||
_breadcrumbs.Append(winrt::make<Breadcrumb>(vm, RS_(L"Nav_Appearance/Content"), BreadcrumbSubPage::None));
|
||||
}
|
||||
else if (*clickedItemTag == addProfileTag)
|
||||
|
||||
@@ -325,7 +325,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
|
||||
SelectedProfile(AvailableProfiles().GetAt(0));
|
||||
|
||||
_rootEntries = _ConvertToViewModelEntries(_Settings.GlobalSettings().NewTabMenu(), _Settings);
|
||||
_rootEntries = _ConvertToViewModelEntries(_Settings.WindowSettingsDefaults().NewTabMenu(), _Settings);
|
||||
_rootEntriesChangedRevoker = _rootEntries.VectorChanged(winrt::auto_revoke, [this](auto&&, const IVectorChangedEventArgs& args) {
|
||||
switch (args.CollectionChange())
|
||||
{
|
||||
@@ -337,25 +337,25 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
{
|
||||
modelEntries.push_back(NewTabMenuEntryViewModel::GetModel(entry));
|
||||
}
|
||||
_Settings.GlobalSettings().NewTabMenu(single_threaded_vector<Model::NewTabMenuEntry>(std::move(modelEntries)));
|
||||
_Settings.WindowSettingsDefaults().NewTabMenu(single_threaded_vector<Model::NewTabMenuEntry>(std::move(modelEntries)));
|
||||
return;
|
||||
}
|
||||
case CollectionChange::ItemInserted:
|
||||
{
|
||||
const auto& insertedEntryVM = _rootEntries.GetAt(args.Index());
|
||||
const auto& insertedEntry = NewTabMenuEntryViewModel::GetModel(insertedEntryVM);
|
||||
_Settings.GlobalSettings().NewTabMenu().InsertAt(args.Index(), insertedEntry);
|
||||
_Settings.WindowSettingsDefaults().NewTabMenu().InsertAt(args.Index(), insertedEntry);
|
||||
return;
|
||||
}
|
||||
case CollectionChange::ItemRemoved:
|
||||
{
|
||||
_Settings.GlobalSettings().NewTabMenu().RemoveAt(args.Index());
|
||||
_Settings.WindowSettingsDefaults().NewTabMenu().RemoveAt(args.Index());
|
||||
return;
|
||||
}
|
||||
case CollectionChange::ItemChanged:
|
||||
{
|
||||
const auto& modifiedEntry = _rootEntries.GetAt(args.Index());
|
||||
_Settings.GlobalSettings().NewTabMenu().SetAt(args.Index(), NewTabMenuEntryViewModel::GetModel(modifiedEntry));
|
||||
_Settings.WindowSettingsDefaults().NewTabMenu().SetAt(args.Index(), NewTabMenuEntryViewModel::GetModel(modifiedEntry));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,9 +13,9 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
{
|
||||
explicit RenderingViewModel(Model::CascadiaSettings settings) noexcept;
|
||||
|
||||
GETSET_BINDABLE_ENUM_SETTING(GraphicsAPI, winrt::Microsoft::Terminal::Control::GraphicsAPI, _settings.GlobalSettings().GraphicsAPI);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_settings.GlobalSettings(), DisablePartialInvalidation);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_settings.GlobalSettings(), SoftwareRendering);
|
||||
GETSET_BINDABLE_ENUM_SETTING(GraphicsAPI, winrt::Microsoft::Terminal::Control::GraphicsAPI, _settings.WindowSettingsDefaults().GraphicsAPI);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_settings.WindowSettingsDefaults(), DisablePartialInvalidation);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_settings.WindowSettingsDefaults(), SoftwareRendering);
|
||||
|
||||
private:
|
||||
Model::CascadiaSettings _settings{ nullptr };
|
||||
|
||||
@@ -111,6 +111,10 @@ Model::CascadiaSettings CascadiaSettings::Copy() const
|
||||
}
|
||||
|
||||
settings->_globals = _globals->Copy();
|
||||
// temporary: instantiate a new window settings shim
|
||||
// will be removed when we have real per-window settings
|
||||
settings->_windowSettings = winrt::make_self<implementation::WindowSettings>();
|
||||
settings->_windowSettings->Initialize(settings->_globals);
|
||||
settings->_allProfiles = winrt::single_threaded_observable_vector(std::move(allProfiles));
|
||||
settings->_activeProfiles = winrt::single_threaded_observable_vector(std::move(activeProfiles));
|
||||
|
||||
@@ -209,6 +213,19 @@ Model::GlobalAppSettings CascadiaSettings::GlobalSettings() const
|
||||
return *_globals;
|
||||
}
|
||||
|
||||
Model::WindowSettings CascadiaSettings::WindowSettingsDefaults() const
|
||||
{
|
||||
return *_windowSettings;
|
||||
}
|
||||
|
||||
Model::WindowSettings CascadiaSettings::WindowSettings(const winrt::hstring& /*windowName*/) const
|
||||
{
|
||||
// In the WIP implementation, we always return the same WindowSettings
|
||||
// object regardless of window name, since per-window settings
|
||||
// storage is not yet implemented.
|
||||
return *_windowSettings;
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Get a reference to our profiles.defaults object
|
||||
// Arguments:
|
||||
@@ -775,7 +792,7 @@ Model::Profile CascadiaSettings::GetProfileForArgs(const Model::NewTerminalArgs&
|
||||
// Case 2 above could be the result of a "nt" or "sp" invocation that doesn't specify anything.
|
||||
// TODO GH#10952: Detect the profile based on the commandline (add matching support)
|
||||
return (!newTerminalArgs || newTerminalArgs.Commandline().empty()) ?
|
||||
FindProfile(GlobalSettings().DefaultProfile()) :
|
||||
FindProfile(_globals->DefaultProfile()) :
|
||||
ProfileDefaults();
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ Author(s):
|
||||
|
||||
#include "GlobalAppSettings.h"
|
||||
#include "Profile.h"
|
||||
#include "WindowSettings.h"
|
||||
|
||||
namespace winrt::Microsoft::Terminal::Settings::Model
|
||||
{
|
||||
@@ -163,6 +164,8 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
winrt::hstring Hash() const noexcept;
|
||||
Model::CascadiaSettings Copy() const;
|
||||
Model::GlobalAppSettings GlobalSettings() const;
|
||||
Model::WindowSettings WindowSettingsDefaults() const;
|
||||
Model::WindowSettings WindowSettings(const winrt::hstring& windowName) const;
|
||||
winrt::Windows::Foundation::Collections::IObservableVector<Model::Profile> AllProfiles() const noexcept;
|
||||
winrt::Windows::Foundation::Collections::IObservableVector<Model::Profile> ActiveProfiles() const noexcept;
|
||||
Model::ActionMap ActionMap() const noexcept;
|
||||
@@ -228,6 +231,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
// user settings
|
||||
winrt::hstring _hash;
|
||||
winrt::com_ptr<implementation::GlobalAppSettings> _globals = winrt::make_self<implementation::GlobalAppSettings>();
|
||||
winrt::com_ptr<implementation::WindowSettings> _windowSettings = winrt::make_self<implementation::WindowSettings>();
|
||||
winrt::com_ptr<implementation::Profile> _baseLayerProfile = winrt::make_self<implementation::Profile>();
|
||||
winrt::Windows::Foundation::Collections::IObservableVector<Model::Profile> _allProfiles = winrt::single_threaded_observable_vector<Model::Profile>();
|
||||
winrt::Windows::Foundation::Collections::IObservableVector<Model::Profile> _activeProfiles = winrt::single_threaded_observable_vector<Model::Profile>();
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// Licensed under the MIT license.
|
||||
|
||||
import "GlobalAppSettings.idl";
|
||||
import "WindowSettings.idl";
|
||||
import "Profile.idl";
|
||||
import "TerminalWarnings.idl";
|
||||
import "DefaultTerminal.idl";
|
||||
@@ -38,6 +39,9 @@ namespace Microsoft.Terminal.Settings.Model
|
||||
|
||||
GlobalAppSettings GlobalSettings { get; };
|
||||
|
||||
WindowSettings WindowSettingsDefaults();
|
||||
WindowSettings WindowSettings(String windowName);
|
||||
|
||||
Profile ProfileDefaults { get; };
|
||||
|
||||
IObservableVector<Profile> AllProfiles { get; };
|
||||
|
||||
@@ -1317,7 +1317,7 @@ void CascadiaSettings::_researchOnLoad()
|
||||
// ----------------------------- RE: Themes ----------------------------
|
||||
const auto numThemes = GlobalSettings().Themes().Size();
|
||||
const auto themeInUse = GlobalSettings().CurrentTheme().Name();
|
||||
const auto changedTheme = GlobalSettings().HasTheme();
|
||||
const auto changedTheme = _globals->HasTheme();
|
||||
|
||||
// system: 0
|
||||
// light: 1
|
||||
@@ -1413,6 +1413,7 @@ CascadiaSettings::CascadiaSettings(SettingsLoader&& loader) :
|
||||
// but we're going to set these fields in our constructor later on anyways.
|
||||
_globals{},
|
||||
_baseLayerProfile{},
|
||||
_windowSettings{},
|
||||
_allProfiles{},
|
||||
_activeProfiles{},
|
||||
_warnings{}
|
||||
@@ -1478,6 +1479,11 @@ CascadiaSettings::CascadiaSettings(SettingsLoader&& loader) :
|
||||
_warnings = winrt::single_threaded_vector(std::move(warnings));
|
||||
_themesChangeLog = std::move(loader.userSettings.themesChangeLog);
|
||||
|
||||
// Initialize the WindowSettings to delegate to the GlobalAppSettings.
|
||||
// In the future, per-window-name settings will be separate objects.
|
||||
_windowSettings = winrt::make_self<implementation::WindowSettings>();
|
||||
_windowSettings->Initialize(_globals);
|
||||
|
||||
_resolveDefaultProfile();
|
||||
_resolveNewTabMenuProfiles();
|
||||
_validateSettings();
|
||||
@@ -1717,7 +1723,7 @@ void CascadiaSettings::_resolveDefaultProfile() const
|
||||
}
|
||||
|
||||
// Use the first profile as the new default.
|
||||
GlobalSettings().DefaultProfile(_allProfiles.GetAt(0).Guid());
|
||||
_globals->DefaultProfile(_allProfiles.GetAt(0).Guid());
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
|
||||
@@ -51,63 +51,18 @@ namespace Microsoft.Terminal.Settings.Model
|
||||
};
|
||||
|
||||
[default_interface] runtimeclass GlobalAppSettings {
|
||||
Guid DefaultProfile;
|
||||
|
||||
INHERITABLE_SETTING(String, UnparsedDefaultProfile);
|
||||
|
||||
INHERITABLE_SETTING(Int32, InitialRows);
|
||||
INHERITABLE_SETTING(Int32, InitialCols);
|
||||
INHERITABLE_SETTING(Boolean, AlwaysShowTabs);
|
||||
INHERITABLE_SETTING(Boolean, ShowTabsFullscreen);
|
||||
INHERITABLE_SETTING(NewTabPosition, NewTabPosition);
|
||||
INHERITABLE_SETTING(Boolean, ShowTitleInTitlebar);
|
||||
INHERITABLE_SETTING(Boolean, ConfirmCloseAllTabs);
|
||||
// ---- Global-only settings (not per-window) ----
|
||||
INHERITABLE_SETTING(String, Language);
|
||||
INHERITABLE_SETTING(Microsoft.UI.Xaml.Controls.TabViewWidthMode, TabWidthMode);
|
||||
INHERITABLE_SETTING(Boolean, UseAcrylicInTabRow);
|
||||
INHERITABLE_SETTING(Boolean, ShowTabsInTitlebar);
|
||||
INHERITABLE_SETTING(String, WordDelimiters);
|
||||
INHERITABLE_SETTING(Boolean, CopyOnSelect);
|
||||
INHERITABLE_SETTING(Boolean, InputServiceWarning);
|
||||
INHERITABLE_SETTING(Microsoft.Terminal.Control.CopyFormat, CopyFormatting);
|
||||
INHERITABLE_SETTING(Boolean, WarnAboutLargePaste);
|
||||
INHERITABLE_SETTING(Microsoft.Terminal.Control.WarnAboutMultiLinePaste, WarnAboutMultiLinePaste);
|
||||
INHERITABLE_SETTING(Boolean, TrimPaste);
|
||||
INHERITABLE_SETTING(LaunchPosition, InitialPosition);
|
||||
INHERITABLE_SETTING(Boolean, CenterOnLaunch);
|
||||
INHERITABLE_SETTING(Microsoft.Terminal.Control.DefaultInputScope, DefaultInputScope);
|
||||
INHERITABLE_SETTING(FirstWindowPreference, FirstWindowPreference);
|
||||
INHERITABLE_SETTING(LaunchMode, LaunchMode);
|
||||
INHERITABLE_SETTING(Boolean, SnapToGridOnResize);
|
||||
INHERITABLE_SETTING(Microsoft.Terminal.Control.GraphicsAPI, GraphicsAPI);
|
||||
INHERITABLE_SETTING(Boolean, DisablePartialInvalidation);
|
||||
INHERITABLE_SETTING(Boolean, SoftwareRendering);
|
||||
INHERITABLE_SETTING(Microsoft.Terminal.Control.TextMeasurement, TextMeasurement);
|
||||
INHERITABLE_SETTING(Microsoft.Terminal.Control.AmbiguousWidth, AmbiguousWidth);
|
||||
INHERITABLE_SETTING(Boolean, UseBackgroundImageForWindow);
|
||||
INHERITABLE_SETTING(Boolean, DebugFeaturesEnabled);
|
||||
INHERITABLE_SETTING(Boolean, AlwaysOnTop);
|
||||
INHERITABLE_SETTING(Boolean, AutoHideWindow);
|
||||
INHERITABLE_SETTING(TabSwitcherMode, TabSwitcherMode);
|
||||
INHERITABLE_SETTING(Boolean, DisableAnimations);
|
||||
INHERITABLE_SETTING(String, StartupActions);
|
||||
INHERITABLE_SETTING(Boolean, FocusFollowMouse);
|
||||
INHERITABLE_SETTING(Boolean, ScrollToZoom);
|
||||
INHERITABLE_SETTING(Boolean, ScrollToChangeOpacity);
|
||||
INHERITABLE_SETTING(WindowingMode, WindowingBehavior);
|
||||
INHERITABLE_SETTING(Boolean, TrimBlockSelection);
|
||||
INHERITABLE_SETTING(Boolean, DetectURLs);
|
||||
INHERITABLE_SETTING(Boolean, MinimizeToNotificationArea);
|
||||
INHERITABLE_SETTING(Boolean, AlwaysShowNotificationIcon);
|
||||
INHERITABLE_SETTING(IVector<String>, DisabledProfileSources);
|
||||
INHERITABLE_SETTING(Boolean, ShowAdminShield);
|
||||
INHERITABLE_SETTING(IVector<NewTabMenuEntry>, NewTabMenu);
|
||||
INHERITABLE_SETTING(Boolean, EnableColorSelection);
|
||||
INHERITABLE_SETTING(Boolean, EnableShellCompletionMenu);
|
||||
INHERITABLE_SETTING(Boolean, EnableUnfocusedAcrylic);
|
||||
INHERITABLE_SETTING(Boolean, AllowHeadless);
|
||||
INHERITABLE_SETTING(String, SearchWebDefaultQueryUrl);
|
||||
INHERITABLE_SETTING(Boolean, EnableColorSelection);
|
||||
|
||||
// ---- Color schemes ----
|
||||
Windows.Foundation.Collections.IMapView<String, ColorScheme> ColorSchemes();
|
||||
void AddColorScheme(ColorScheme scheme);
|
||||
void RemoveColorScheme(String schemeName);
|
||||
@@ -115,9 +70,9 @@ namespace Microsoft.Terminal.Settings.Model
|
||||
|
||||
ActionMap ActionMap { get; };
|
||||
|
||||
// ---- Themes ----
|
||||
Windows.Foundation.Collections.IMapView<String, Theme> Themes();
|
||||
void AddTheme(Theme theme);
|
||||
INHERITABLE_SETTING(ThemePair, Theme);
|
||||
Theme CurrentTheme { get; };
|
||||
|
||||
Boolean ShouldUsePersistedLayout();
|
||||
|
||||
@@ -18,7 +18,20 @@ Author(s):
|
||||
// Macro format (defaultArgs are optional):
|
||||
// (type, name, jsonKey, defaultArgs)
|
||||
|
||||
#define MTSM_GLOBAL_SETTINGS(X) \
|
||||
// Settings that are truly app-global (not per-window)
|
||||
#define MTSM_GLOBAL_ONLY_SETTINGS(X) \
|
||||
X(hstring, Language, "language") \
|
||||
X(bool, InputServiceWarning, "warning.inputService", true) \
|
||||
X(Model::FirstWindowPreference, FirstWindowPreference, "firstWindowPreference", FirstWindowPreference::DefaultProfile) \
|
||||
X(bool, DebugFeaturesEnabled, "debugFeatures", debugFeaturesDefault) \
|
||||
X(Model::WindowingMode, WindowingBehavior, "windowingBehavior", Model::WindowingMode::UseNew) \
|
||||
X(bool, AlwaysShowNotificationIcon, "alwaysShowNotificationIcon", false) \
|
||||
X(winrt::Windows::Foundation::Collections::IVector<winrt::hstring>, DisabledProfileSources, "disabledProfileSources", nullptr) \
|
||||
X(bool, AllowHeadless, "compatibility.allowHeadless", false) \
|
||||
X(bool, EnableColorSelection, "experimental.enableColorSelection", false)
|
||||
|
||||
// Settings that are per-window (may vary by window name in the future)
|
||||
#define MTSM_WINDOW_SETTINGS(X) \
|
||||
X(int32_t, InitialRows, "initialRows", 30) \
|
||||
X(int32_t, InitialCols, "initialCols", 80) \
|
||||
X(hstring, WordDelimiters, "wordDelimiters", DEFAULT_WORD_DELIMITERS) \
|
||||
@@ -40,39 +53,36 @@ Author(s):
|
||||
X(bool, ShowTitleInTitlebar, "showTerminalTitleInTitlebar", true) \
|
||||
X(bool, ConfirmCloseAllTabs, "warning.confirmCloseAllTabs", true) \
|
||||
X(Model::ThemePair, Theme, "theme") \
|
||||
X(hstring, Language, "language") \
|
||||
X(winrt::Microsoft::UI::Xaml::Controls::TabViewWidthMode, TabWidthMode, "tabWidthMode", winrt::Microsoft::UI::Xaml::Controls::TabViewWidthMode::Equal) \
|
||||
X(bool, UseAcrylicInTabRow, "useAcrylicInTabRow", false) \
|
||||
X(bool, ShowTabsInTitlebar, "showTabsInTitlebar", true) \
|
||||
X(bool, InputServiceWarning, "warning.inputService", true) \
|
||||
X(winrt::Microsoft::Terminal::Control::CopyFormat, CopyFormatting, "copyFormatting", 0) \
|
||||
X(bool, WarnAboutLargePaste, "warning.largePaste", true) \
|
||||
X(winrt::Microsoft::Terminal::Control::WarnAboutMultiLinePaste, WarnAboutMultiLinePaste, "warning.multiLinePaste", winrt::Microsoft::Terminal::Control::WarnAboutMultiLinePaste::Automatic) \
|
||||
X(Model::LaunchPosition, InitialPosition, "initialPosition", nullptr, nullptr) \
|
||||
X(bool, CenterOnLaunch, "centerOnLaunch", false) \
|
||||
X(Model::FirstWindowPreference, FirstWindowPreference, "firstWindowPreference", FirstWindowPreference::DefaultProfile) \
|
||||
X(Model::LaunchMode, LaunchMode, "launchMode", LaunchMode::DefaultMode) \
|
||||
X(bool, SnapToGridOnResize, "snapToGridOnResize", true) \
|
||||
X(bool, DebugFeaturesEnabled, "debugFeatures", debugFeaturesDefault) \
|
||||
X(bool, AlwaysOnTop, "alwaysOnTop", false) \
|
||||
X(bool, AutoHideWindow, "autoHideWindow", false) \
|
||||
X(Model::TabSwitcherMode, TabSwitcherMode, "tabSwitcherMode", Model::TabSwitcherMode::InOrder) \
|
||||
X(bool, DisableAnimations, "disableAnimations", false) \
|
||||
X(hstring, StartupActions, "startupActions", L"") \
|
||||
X(Model::WindowingMode, WindowingBehavior, "windowingBehavior", Model::WindowingMode::UseNew) \
|
||||
X(bool, MinimizeToNotificationArea, "minimizeToNotificationArea", false) \
|
||||
X(bool, AlwaysShowNotificationIcon, "alwaysShowNotificationIcon", false) \
|
||||
X(winrt::Windows::Foundation::Collections::IVector<winrt::hstring>, DisabledProfileSources, "disabledProfileSources", nullptr) \
|
||||
X(bool, ShowAdminShield, "showAdminShield", true) \
|
||||
X(bool, TrimPaste, "trimPaste", true) \
|
||||
X(bool, EnableColorSelection, "experimental.enableColorSelection", false) \
|
||||
X(bool, EnableShellCompletionMenu, "experimental.enableShellCompletionMenu", false) \
|
||||
X(bool, EnableUnfocusedAcrylic, "compatibility.enableUnfocusedAcrylic", true) \
|
||||
X(winrt::Windows::Foundation::Collections::IVector<Model::NewTabMenuEntry>, NewTabMenu, "newTabMenu", winrt::single_threaded_vector<Model::NewTabMenuEntry>({ Model::RemainingProfilesEntry{} })) \
|
||||
X(bool, AllowHeadless, "compatibility.allowHeadless", false) \
|
||||
X(hstring, SearchWebDefaultQueryUrl, "searchWebDefaultQueryUrl", L"https://www.bing.com/search?q=%22%s%22") \
|
||||
X(bool, ShowTabsFullscreen, "showTabsFullscreen", false)
|
||||
|
||||
// MTSM_GLOBAL_SETTINGS is the union of global-only and window settings.
|
||||
// GlobalAppSettings uses this to keep all settings on one object (for now).
|
||||
#define MTSM_GLOBAL_SETTINGS(X) \
|
||||
MTSM_GLOBAL_ONLY_SETTINGS(X) \
|
||||
MTSM_WINDOW_SETTINGS(X)
|
||||
|
||||
// Also add these settings to:
|
||||
// * Profile.idl
|
||||
// * TerminalSettings.h
|
||||
|
||||
@@ -82,6 +82,9 @@
|
||||
<ClInclude Include="GlobalAppSettings.h">
|
||||
<DependentUpon>GlobalAppSettings.idl</DependentUpon>
|
||||
</ClInclude>
|
||||
<ClInclude Include="WindowSettings.h">
|
||||
<DependentUpon>WindowSettings.idl</DependentUpon>
|
||||
</ClInclude>
|
||||
<ClInclude Include="IInheritable.h" />
|
||||
<ClInclude Include="MTSMSettings.h" />
|
||||
<ClInclude Include="IDynamicProfileGenerator.h" />
|
||||
@@ -161,6 +164,9 @@
|
||||
<ClCompile Include="GlobalAppSettings.cpp">
|
||||
<DependentUpon>GlobalAppSettings.idl</DependentUpon>
|
||||
</ClCompile>
|
||||
<ClCompile Include="WindowSettings.cpp">
|
||||
<DependentUpon>WindowSettings.idl</DependentUpon>
|
||||
</ClCompile>
|
||||
<ClCompile Include="KeyChordSerialization.cpp">
|
||||
<DependentUpon>KeyChordSerialization.idl</DependentUpon>
|
||||
</ClCompile>
|
||||
@@ -222,6 +228,7 @@
|
||||
<Midl Include="Command.idl" />
|
||||
<Midl Include="DefaultTerminal.idl" />
|
||||
<Midl Include="GlobalAppSettings.idl" />
|
||||
<Midl Include="WindowSettings.idl" />
|
||||
<Midl Include="Profile.idl" />
|
||||
<Midl Include="EnumMappings.idl" />
|
||||
<Midl Include="TerminalWarnings.idl" />
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
<ClCompile Include="CascadiaSettings.cpp" />
|
||||
<ClCompile Include="CascadiaSettingsSerialization.cpp" />
|
||||
<ClCompile Include="GlobalAppSettings.cpp" />
|
||||
<ClCompile Include="WindowSettings.cpp" />
|
||||
<ClCompile Include="KeyChordSerialization.cpp" />
|
||||
<ClCompile Include="Profile.cpp" />
|
||||
<ClCompile Include="ColorScheme.cpp" />
|
||||
@@ -66,6 +67,7 @@
|
||||
</ClInclude>
|
||||
<ClInclude Include="CascadiaSettings.h" />
|
||||
<ClInclude Include="GlobalAppSettings.h" />
|
||||
<ClInclude Include="WindowSettings.h" />
|
||||
<ClInclude Include="TerminalSettingsSerializationHelpers.h" />
|
||||
<ClInclude Include="KeyChordSerialization.h" />
|
||||
<ClInclude Include="Profile.h" />
|
||||
@@ -104,6 +106,7 @@
|
||||
<Midl Include="ColorScheme.idl" />
|
||||
<Midl Include="Command.idl" />
|
||||
<Midl Include="GlobalAppSettings.idl" />
|
||||
<Midl Include="WindowSettings.idl" />
|
||||
<Midl Include="Profile.idl" />
|
||||
<Midl Include="TerminalWarnings.idl" />
|
||||
<Midl Include="CascadiaSettings.idl" />
|
||||
|
||||
57
src/cascadia/TerminalSettingsModel/WindowSettings.cpp
Normal file
57
src/cascadia/TerminalSettingsModel/WindowSettings.cpp
Normal file
@@ -0,0 +1,57 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
#include "pch.h"
|
||||
#include "WindowSettings.h"
|
||||
#include "WindowSettings.g.cpp"
|
||||
|
||||
#include "GlobalAppSettings.h"
|
||||
|
||||
namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
{
|
||||
void WindowSettings::Initialize(const com_ptr<GlobalAppSettings>& globals)
|
||||
{
|
||||
_globals = globals;
|
||||
}
|
||||
|
||||
hstring WindowSettings::Name() const
|
||||
{
|
||||
// In the WIP implementation, there is only one set of window settings
|
||||
// (backed by GlobalAppSettings), so the name is always empty.
|
||||
return L"";
|
||||
}
|
||||
|
||||
winrt::guid WindowSettings::DefaultProfile() const
|
||||
{
|
||||
return _globals->DefaultProfile();
|
||||
}
|
||||
|
||||
void WindowSettings::DefaultProfile(const winrt::guid& value)
|
||||
{
|
||||
_globals->DefaultProfile(value);
|
||||
}
|
||||
|
||||
hstring WindowSettings::UnparsedDefaultProfile() const
|
||||
{
|
||||
return _globals->UnparsedDefaultProfile();
|
||||
}
|
||||
|
||||
void WindowSettings::UnparsedDefaultProfile(const hstring& value)
|
||||
{
|
||||
_globals->UnparsedDefaultProfile(value);
|
||||
}
|
||||
|
||||
bool WindowSettings::HasUnparsedDefaultProfile() const
|
||||
{
|
||||
return _globals->HasUnparsedDefaultProfile();
|
||||
}
|
||||
|
||||
void WindowSettings::ClearUnparsedDefaultProfile()
|
||||
{
|
||||
_globals->ClearUnparsedDefaultProfile();
|
||||
}
|
||||
|
||||
// The MTSM_WINDOW_SETTINGS delegate methods are defined inline
|
||||
// in WindowSettings.h via the WINDOW_SETTINGS_DELEGATE macro.
|
||||
|
||||
}
|
||||
61
src/cascadia/TerminalSettingsModel/WindowSettings.h
Normal file
61
src/cascadia/TerminalSettingsModel/WindowSettings.h
Normal file
@@ -0,0 +1,61 @@
|
||||
/*++
|
||||
Copyright (c) Microsoft Corporation
|
||||
Licensed under the MIT license.
|
||||
|
||||
Module Name:
|
||||
- WindowSettings.h
|
||||
|
||||
Abstract:
|
||||
- This class represents per-window settings. In the current WIP implementation,
|
||||
it delegates all property access to a GlobalAppSettings object, since we
|
||||
haven't yet split the actual storage into per-window instances.
|
||||
|
||||
Author(s):
|
||||
- Mike Griese - April 2026
|
||||
|
||||
--*/
|
||||
#pragma once
|
||||
|
||||
#include "WindowSettings.g.h"
|
||||
#include "MTSMSettings.h"
|
||||
#include "GlobalAppSettings.h"
|
||||
|
||||
namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
{
|
||||
struct WindowSettings : WindowSettingsT<WindowSettings>
|
||||
{
|
||||
public:
|
||||
// Default constructor required by WinRT activation
|
||||
WindowSettings() = default;
|
||||
|
||||
// Construct a WindowSettings that delegates to the given GlobalAppSettings.
|
||||
void Initialize(const com_ptr<GlobalAppSettings>& globals);
|
||||
|
||||
hstring Name() const;
|
||||
|
||||
winrt::guid DefaultProfile() const;
|
||||
void DefaultProfile(const winrt::guid& value);
|
||||
|
||||
hstring UnparsedDefaultProfile() const;
|
||||
void UnparsedDefaultProfile(const hstring& value);
|
||||
bool HasUnparsedDefaultProfile() const;
|
||||
void ClearUnparsedDefaultProfile();
|
||||
|
||||
// Delegate all MTSM_WINDOW_SETTINGS to GlobalAppSettings via inline methods.
|
||||
#define WINDOW_SETTINGS_DELEGATE(type, name, ...) \
|
||||
type name() const { return _globals->name(); } \
|
||||
void name(const type& value) { _globals->name(value); } \
|
||||
bool Has##name() const { return _globals->Has##name(); } \
|
||||
void Clear##name() { _globals->Clear##name(); }
|
||||
MTSM_WINDOW_SETTINGS(WINDOW_SETTINGS_DELEGATE)
|
||||
#undef WINDOW_SETTINGS_DELEGATE
|
||||
|
||||
private:
|
||||
com_ptr<GlobalAppSettings> _globals{ nullptr };
|
||||
};
|
||||
}
|
||||
|
||||
namespace winrt::Microsoft::Terminal::Settings::Model::factory_implementation
|
||||
{
|
||||
BASIC_FACTORY(WindowSettings);
|
||||
}
|
||||
65
src/cascadia/TerminalSettingsModel/WindowSettings.idl
Normal file
65
src/cascadia/TerminalSettingsModel/WindowSettings.idl
Normal file
@@ -0,0 +1,65 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
#include "IInheritable.idl.h"
|
||||
|
||||
import "GlobalAppSettings.idl";
|
||||
import "NewTabMenuEntry.idl";
|
||||
|
||||
namespace Microsoft.Terminal.Settings.Model
|
||||
{
|
||||
[default_interface] runtimeclass WindowSettings
|
||||
{
|
||||
WindowSettings();
|
||||
|
||||
String Name { get; };
|
||||
Guid DefaultProfile;
|
||||
|
||||
INHERITABLE_SETTING(String, UnparsedDefaultProfile);
|
||||
|
||||
INHERITABLE_SETTING(Int32, InitialRows);
|
||||
INHERITABLE_SETTING(Int32, InitialCols);
|
||||
INHERITABLE_SETTING(Boolean, AlwaysShowTabs);
|
||||
INHERITABLE_SETTING(Boolean, ShowTabsFullscreen);
|
||||
INHERITABLE_SETTING(NewTabPosition, NewTabPosition);
|
||||
INHERITABLE_SETTING(Boolean, ShowTitleInTitlebar);
|
||||
INHERITABLE_SETTING(Boolean, ConfirmCloseAllTabs);
|
||||
INHERITABLE_SETTING(Microsoft.UI.Xaml.Controls.TabViewWidthMode, TabWidthMode);
|
||||
INHERITABLE_SETTING(Boolean, UseAcrylicInTabRow);
|
||||
INHERITABLE_SETTING(Boolean, ShowTabsInTitlebar);
|
||||
INHERITABLE_SETTING(String, WordDelimiters);
|
||||
INHERITABLE_SETTING(Boolean, CopyOnSelect);
|
||||
INHERITABLE_SETTING(Microsoft.Terminal.Control.CopyFormat, CopyFormatting);
|
||||
INHERITABLE_SETTING(Boolean, WarnAboutLargePaste);
|
||||
INHERITABLE_SETTING(Microsoft.Terminal.Control.WarnAboutMultiLinePaste, WarnAboutMultiLinePaste);
|
||||
INHERITABLE_SETTING(Boolean, TrimPaste);
|
||||
INHERITABLE_SETTING(LaunchPosition, InitialPosition);
|
||||
INHERITABLE_SETTING(Boolean, CenterOnLaunch);
|
||||
INHERITABLE_SETTING(Microsoft.Terminal.Control.DefaultInputScope, DefaultInputScope);
|
||||
INHERITABLE_SETTING(LaunchMode, LaunchMode);
|
||||
INHERITABLE_SETTING(Boolean, SnapToGridOnResize);
|
||||
INHERITABLE_SETTING(Microsoft.Terminal.Control.GraphicsAPI, GraphicsAPI);
|
||||
INHERITABLE_SETTING(Boolean, DisablePartialInvalidation);
|
||||
INHERITABLE_SETTING(Boolean, SoftwareRendering);
|
||||
INHERITABLE_SETTING(Microsoft.Terminal.Control.TextMeasurement, TextMeasurement);
|
||||
INHERITABLE_SETTING(Microsoft.Terminal.Control.AmbiguousWidth, AmbiguousWidth);
|
||||
INHERITABLE_SETTING(Boolean, UseBackgroundImageForWindow);
|
||||
INHERITABLE_SETTING(Boolean, AlwaysOnTop);
|
||||
INHERITABLE_SETTING(Boolean, AutoHideWindow);
|
||||
INHERITABLE_SETTING(TabSwitcherMode, TabSwitcherMode);
|
||||
INHERITABLE_SETTING(Boolean, DisableAnimations);
|
||||
INHERITABLE_SETTING(String, StartupActions);
|
||||
INHERITABLE_SETTING(Boolean, FocusFollowMouse);
|
||||
INHERITABLE_SETTING(Boolean, ScrollToZoom);
|
||||
INHERITABLE_SETTING(Boolean, ScrollToChangeOpacity);
|
||||
INHERITABLE_SETTING(Boolean, TrimBlockSelection);
|
||||
INHERITABLE_SETTING(Boolean, DetectURLs);
|
||||
INHERITABLE_SETTING(Boolean, MinimizeToNotificationArea);
|
||||
INHERITABLE_SETTING(Boolean, ShowAdminShield);
|
||||
INHERITABLE_SETTING(IVector<NewTabMenuEntry>, NewTabMenu);
|
||||
INHERITABLE_SETTING(Boolean, EnableShellCompletionMenu);
|
||||
INHERITABLE_SETTING(Boolean, EnableUnfocusedAcrylic);
|
||||
INHERITABLE_SETTING(String, SearchWebDefaultQueryUrl);
|
||||
INHERITABLE_SETTING(ThemePair, Theme);
|
||||
}
|
||||
}
|
||||
@@ -235,7 +235,7 @@ namespace SettingsModelUnitTests
|
||||
const auto settings = createSettings(goodProfiles);
|
||||
VERIFY_ARE_EQUAL(static_cast<size_t>(0), settings->Warnings().Size());
|
||||
VERIFY_ARE_EQUAL(static_cast<size_t>(2), settings->AllProfiles().Size());
|
||||
VERIFY_ARE_EQUAL(settings->GlobalSettings().DefaultProfile(), settings->AllProfiles().GetAt(0).Guid());
|
||||
VERIFY_ARE_EQUAL(settings->WindowSettingsDefaults().DefaultProfile(), settings->AllProfiles().GetAt(0).Guid());
|
||||
}
|
||||
{
|
||||
// Case 2: Bad settings
|
||||
@@ -246,7 +246,7 @@ namespace SettingsModelUnitTests
|
||||
VERIFY_ARE_EQUAL(SettingsLoadWarnings::MissingDefaultProfile, settings->Warnings().GetAt(0));
|
||||
|
||||
VERIFY_ARE_EQUAL(static_cast<size_t>(2), settings->AllProfiles().Size());
|
||||
VERIFY_ARE_EQUAL(settings->GlobalSettings().DefaultProfile(), settings->AllProfiles().GetAt(0).Guid());
|
||||
VERIFY_ARE_EQUAL(settings->WindowSettingsDefaults().DefaultProfile(), settings->AllProfiles().GetAt(0).Guid());
|
||||
}
|
||||
{
|
||||
// Case 2: Bad settings
|
||||
@@ -257,7 +257,7 @@ namespace SettingsModelUnitTests
|
||||
VERIFY_ARE_EQUAL(SettingsLoadWarnings::MissingDefaultProfile, settings->Warnings().GetAt(0));
|
||||
|
||||
VERIFY_ARE_EQUAL(static_cast<size_t>(2), settings->AllProfiles().Size());
|
||||
VERIFY_ARE_EQUAL(settings->GlobalSettings().DefaultProfile(), settings->AllProfiles().GetAt(0).Guid());
|
||||
VERIFY_ARE_EQUAL(settings->WindowSettingsDefaults().DefaultProfile(), settings->AllProfiles().GetAt(0).Guid());
|
||||
}
|
||||
{
|
||||
// Case 4: Good settings, default profile is a string
|
||||
@@ -266,7 +266,7 @@ namespace SettingsModelUnitTests
|
||||
const auto settings = createSettings(goodProfilesSpecifiedByName);
|
||||
VERIFY_ARE_EQUAL(static_cast<size_t>(0), settings->Warnings().Size());
|
||||
VERIFY_ARE_EQUAL(static_cast<size_t>(2), settings->AllProfiles().Size());
|
||||
VERIFY_ARE_EQUAL(settings->GlobalSettings().DefaultProfile(), settings->AllProfiles().GetAt(1).Guid());
|
||||
VERIFY_ARE_EQUAL(settings->WindowSettingsDefaults().DefaultProfile(), settings->AllProfiles().GetAt(1).Guid());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -354,7 +354,7 @@ namespace SettingsModelUnitTests
|
||||
VERIFY_ARE_EQUAL(SettingsLoadWarnings::MissingDefaultProfile, settings->Warnings().GetAt(1));
|
||||
|
||||
VERIFY_ARE_EQUAL(3u, settings->AllProfiles().Size());
|
||||
VERIFY_ARE_EQUAL(settings->AllProfiles().GetAt(0).Guid(), settings->GlobalSettings().DefaultProfile());
|
||||
VERIFY_ARE_EQUAL(settings->AllProfiles().GetAt(0).Guid(), settings->WindowSettingsDefaults().DefaultProfile());
|
||||
}
|
||||
|
||||
void DeserializationTests::LayerGlobalProperties()
|
||||
@@ -376,10 +376,10 @@ namespace SettingsModelUnitTests
|
||||
})" };
|
||||
|
||||
const auto settings = winrt::make_self<implementation::CascadiaSettings>(userSettings, inboxSettings);
|
||||
VERIFY_ARE_EQUAL(true, settings->GlobalSettings().AlwaysShowTabs());
|
||||
VERIFY_ARE_EQUAL(240, settings->GlobalSettings().InitialCols());
|
||||
VERIFY_ARE_EQUAL(60, settings->GlobalSettings().InitialRows());
|
||||
VERIFY_ARE_EQUAL(false, settings->GlobalSettings().ShowTabsInTitlebar());
|
||||
VERIFY_ARE_EQUAL(true, settings->WindowSettingsDefaults().AlwaysShowTabs());
|
||||
VERIFY_ARE_EQUAL(240, settings->WindowSettingsDefaults().InitialCols());
|
||||
VERIFY_ARE_EQUAL(60, settings->WindowSettingsDefaults().InitialRows());
|
||||
VERIFY_ARE_EQUAL(false, settings->WindowSettingsDefaults().ShowTabsInTitlebar());
|
||||
}
|
||||
|
||||
void DeserializationTests::ValidateProfileOrdering()
|
||||
@@ -989,7 +989,7 @@ namespace SettingsModelUnitTests
|
||||
|
||||
VERIFY_IS_NOT_NULL(settings->ProfileDefaults());
|
||||
|
||||
VERIFY_ARE_EQUAL(L"{6239a42c-1111-49a3-80bd-e8fdd045185c}", settings->GlobalSettings().UnparsedDefaultProfile());
|
||||
VERIFY_ARE_EQUAL(L"{6239a42c-1111-49a3-80bd-e8fdd045185c}", settings->WindowSettingsDefaults().UnparsedDefaultProfile());
|
||||
VERIFY_ARE_EQUAL(2u, settings->AllProfiles().Size());
|
||||
|
||||
VERIFY_ARE_EQUAL(2345, settings->AllProfiles().GetAt(0).HistorySize());
|
||||
@@ -1027,7 +1027,7 @@ namespace SettingsModelUnitTests
|
||||
|
||||
const auto settings = winrt::make_self<implementation::CascadiaSettings>(settings0String, implementation::LoadStringResource(IDR_DEFAULTS));
|
||||
|
||||
VERIFY_ARE_EQUAL(guid1String, settings->GlobalSettings().UnparsedDefaultProfile());
|
||||
VERIFY_ARE_EQUAL(guid1String, settings->WindowSettingsDefaults().UnparsedDefaultProfile());
|
||||
VERIFY_ARE_EQUAL(4u, settings->AllProfiles().Size());
|
||||
VERIFY_ARE_EQUAL(guid1, settings->AllProfiles().GetAt(0).Guid());
|
||||
VERIFY_ARE_NOT_EQUAL(guid1, settings->AllProfiles().GetAt(1).Guid());
|
||||
@@ -1273,8 +1273,8 @@ namespace SettingsModelUnitTests
|
||||
|
||||
const auto settings = createSettings(inputSettings);
|
||||
|
||||
VERIFY_ARE_EQUAL(999, settings->GlobalSettings().InitialCols());
|
||||
VERIFY_ARE_EQUAL(1, settings->GlobalSettings().InitialRows());
|
||||
VERIFY_ARE_EQUAL(999, settings->WindowSettingsDefaults().InitialCols());
|
||||
VERIFY_ARE_EQUAL(1, settings->WindowSettingsDefaults().InitialRows());
|
||||
}
|
||||
|
||||
void DeserializationTests::TestTrailingCommas()
|
||||
@@ -1757,7 +1757,7 @@ namespace SettingsModelUnitTests
|
||||
const auto copyImpl{ winrt::get_self<implementation::CascadiaSettings>(copy) };
|
||||
|
||||
// test globals
|
||||
VERIFY_ARE_EQUAL(settings->GlobalSettings().DefaultProfile(), copyImpl->GlobalSettings().DefaultProfile());
|
||||
VERIFY_ARE_EQUAL(settings->WindowSettingsDefaults().DefaultProfile(), copyImpl->WindowSettingsDefaults().DefaultProfile());
|
||||
|
||||
// test profiles
|
||||
VERIFY_ARE_EQUAL(settings->AllProfiles().Size(), copyImpl->AllProfiles().Size());
|
||||
@@ -1775,9 +1775,9 @@ namespace SettingsModelUnitTests
|
||||
VERIFY_ARE_EQUAL(nameMapOriginal.Size(), nameMapCopy.Size());
|
||||
|
||||
// Test that changing the copy should not change the original
|
||||
VERIFY_ARE_EQUAL(settings->GlobalSettings().WordDelimiters(), copyImpl->GlobalSettings().WordDelimiters());
|
||||
copyImpl->GlobalSettings().WordDelimiters(L"changed value");
|
||||
VERIFY_ARE_NOT_EQUAL(settings->GlobalSettings().WordDelimiters(), copyImpl->GlobalSettings().WordDelimiters());
|
||||
VERIFY_ARE_EQUAL(settings->WindowSettingsDefaults().WordDelimiters(), copyImpl->WindowSettingsDefaults().WordDelimiters());
|
||||
copyImpl->WindowSettingsDefaults().WordDelimiters(L"changed value");
|
||||
VERIFY_ARE_NOT_EQUAL(settings->WindowSettingsDefaults().WordDelimiters(), copyImpl->WindowSettingsDefaults().WordDelimiters());
|
||||
}
|
||||
|
||||
void DeserializationTests::TestCloneInheritanceTree()
|
||||
@@ -1813,7 +1813,7 @@ namespace SettingsModelUnitTests
|
||||
const auto copyImpl{ winrt::get_self<implementation::CascadiaSettings>(copy) };
|
||||
|
||||
// test globals
|
||||
VERIFY_ARE_EQUAL(settings->GlobalSettings().DefaultProfile(), copyImpl->GlobalSettings().DefaultProfile());
|
||||
VERIFY_ARE_EQUAL(settings->WindowSettingsDefaults().DefaultProfile(), copyImpl->WindowSettingsDefaults().DefaultProfile());
|
||||
|
||||
// test profiles
|
||||
VERIFY_ARE_EQUAL(settings->AllProfiles().Size(), copyImpl->AllProfiles().Size());
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace SettingsModelUnitTests
|
||||
|
||||
VERIFY_ARE_EQUAL(0u, settings->Warnings().Size());
|
||||
|
||||
const auto& entries = settings->GlobalSettings().NewTabMenu();
|
||||
const auto& entries = settings->WindowSettingsDefaults().NewTabMenu();
|
||||
VERIFY_ARE_EQUAL(1u, entries.Size());
|
||||
VERIFY_ARE_EQUAL(winrt::Microsoft::Terminal::Settings::Model::NewTabMenuEntryType::RemainingProfiles, entries.GetAt(0).Type());
|
||||
}
|
||||
@@ -74,7 +74,7 @@ namespace SettingsModelUnitTests
|
||||
|
||||
VERIFY_ARE_EQUAL(0u, settings->Warnings().Size());
|
||||
|
||||
const auto& entries = settings->GlobalSettings().NewTabMenu();
|
||||
const auto& entries = settings->WindowSettingsDefaults().NewTabMenu();
|
||||
VERIFY_ARE_EQUAL(1u, entries.Size());
|
||||
}
|
||||
catch (const SettingsException& ex)
|
||||
|
||||
@@ -695,7 +695,7 @@ namespace SettingsModelUnitTests
|
||||
|
||||
VERIFY_ARE_EQUAL(2u, settings->Warnings().Size());
|
||||
VERIFY_ARE_EQUAL(2u, settings->ActiveProfiles().Size());
|
||||
VERIFY_ARE_EQUAL(settings->GlobalSettings().DefaultProfile(), settings->ActiveProfiles().GetAt(0).Guid());
|
||||
VERIFY_ARE_EQUAL(settings->WindowSettingsDefaults().DefaultProfile(), settings->ActiveProfiles().GetAt(0).Guid());
|
||||
try
|
||||
{
|
||||
const auto settingsStruct{ TerminalSettings::CreateWithNewTerminalArgs(*settings, nullptr) };
|
||||
|
||||
@@ -1442,8 +1442,9 @@ void WindowEmperor::_checkWindowsForNotificationIcon()
|
||||
// themselves getting the new settings, only ask the app logic for the
|
||||
// RequestsTrayIcon setting value, and combine that with the result of each
|
||||
// window (which won't change during a settings reload).
|
||||
const auto globals = _app.Logic().Settings().GlobalSettings();
|
||||
auto needsIcon = globals.AlwaysShowNotificationIcon() || globals.MinimizeToNotificationArea();
|
||||
const auto settings = _app.Logic().Settings();
|
||||
const auto globals = settings.GlobalSettings();
|
||||
auto needsIcon = globals.AlwaysShowNotificationIcon() || settings.WindowSettingsDefaults().MinimizeToNotificationArea();
|
||||
if (!needsIcon)
|
||||
{
|
||||
for (const auto& host : _windows)
|
||||
|
||||
Reference in New Issue
Block a user