Compare commits

...

6 Commits

2 changed files with 15 additions and 19 deletions

View File

@@ -189,15 +189,18 @@ namespace winrt::TerminalApp::implementation
_isElevated = ::Microsoft::Console::Utils::IsElevated();
_root = winrt::make_self<TerminalPage>();
_reloadSettings = std::make_shared<ThrottledFuncTrailing<>>(winrt::Windows::System::DispatcherQueue::GetForCurrentThread(), std::chrono::milliseconds(100), [weakSelf = get_weak()]() {
if (auto self{ weakSelf.get() })
{
self->ReloadSettings();
}
});
_reloadSettings = std::make_shared<ThrottledFuncTrailing<const bool>>(
winrt::Windows::System::DispatcherQueue::GetForCurrentThread(),
std::chrono::milliseconds(100),
[weakSelf = get_weak()](const bool keybindingsOnly) {
if (auto self{ weakSelf.get() })
{
self->ReloadSettings(keybindingsOnly);
}
});
_languageProfileNotifier = winrt::make_self<LanguageProfileNotifier>([this]() {
_reloadSettings->Run();
_reloadSettings->Run(true);
});
}
@@ -927,7 +930,7 @@ namespace winrt::TerminalApp::implementation
if (modifiedBasename == settingsBasename)
{
_reloadSettings->Run();
_reloadSettings->Run(false);
}
else if (ApplicationState::SharedInstance().IsStatePath(modifiedBasename))
{
@@ -1026,14 +1029,7 @@ namespace winrt::TerminalApp::implementation
// Method Description:
// - Reloads the settings from the settings.json file.
// - When this is called the first time, this initializes our settings. See
// CascadiaSettings for more details. Additionally hooks up our callbacks
// for keybinding events to the keybindings object.
// - NOTE: when called initially, this must be called from a MTA if we're
// running as a packaged application. The Windows.Storage APIs require a
// MTA. If this isn't happening during startup, it'll need to happen on
// a background thread.
void AppLogic::ReloadSettings()
void AppLogic::ReloadSettings(const bool keybindingsOnly)
{
// Attempt to load our settings.
// If it fails,
@@ -1076,7 +1072,7 @@ namespace winrt::TerminalApp::implementation
// TerminalSettings object.
// Update the settings in TerminalPage
_root->SetSettings(_settings, true);
_root->SetSettings(_settings, !keybindingsOnly);
_ApplyLanguageSettingChange();
_RefreshThemeRoutine();

View File

@@ -62,7 +62,7 @@ namespace winrt::TerminalApp::implementation
bool IsUwp() const noexcept;
void RunAsUwp();
bool IsElevated() const noexcept;
void ReloadSettings();
void ReloadSettings(const bool keybindingsOnly = false);
[[nodiscard]] Microsoft::Terminal::Settings::Model::CascadiaSettings GetSettings() const noexcept;
@@ -171,7 +171,7 @@ namespace winrt::TerminalApp::implementation
::TerminalApp::AppCommandlineArgs _appArgs;
::TerminalApp::AppCommandlineArgs _settingsAppArgs;
std::shared_ptr<ThrottledFuncTrailing<>> _reloadSettings;
std::shared_ptr<ThrottledFuncTrailing<const bool>> _reloadSettings;
til::throttled_func_trailing<> _reloadState;
// These fields invoke _reloadSettings and must be destroyed before _reloadSettings.