fake _quake

This commit is contained in:
Mike Griese
2026-06-16 15:21:43 -05:00
parent 5bb0dc3746
commit 1f5df413e6
3 changed files with 39 additions and 0 deletions

View File

@@ -223,6 +223,14 @@ Model::WindowSettings CascadiaSettings::WindowSettings(const winrt::hstring& win
{
return it;
}
// The "_quake" window is special: even if the user never defined a
// "_quake" entry, we still hand back a synthesized WindowSettings that's
// initialized for quake mode (see the SettingsLoader-consuming ctor).
if (_quakeWindowSettings && windowName == L"_quake")
{
return *_quakeWindowSettings;
}
}
return *_baseWindowSettings;
}

View File

@@ -243,6 +243,11 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
winrt::com_ptr<implementation::WindowSettings> _baseWindowSettings = winrt::make_self<implementation::WindowSettings>();
Windows::Foundation::Collections::IMap<winrt::hstring, Model::WindowSettings> _windows{ winrt::single_threaded_map<winrt::hstring, Model::WindowSettings>() };
// The special "_quake" window always exists, even if the user never
// defined one in their settings. When that's the case, this holds a
// synthesized "fake" WindowSettings initialized for quake mode. It is
// deliberately kept out of _windows so it's never written back to disk.
winrt::com_ptr<implementation::WindowSettings> _quakeWindowSettings{ nullptr };
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>();

View File

@@ -1516,6 +1516,22 @@ CascadiaSettings::CascadiaSettings(SettingsLoader&& loader) :
_windows.Insert(name, *window);
}
// The "_quake" window is always treated specially. Even if the user never
// defined a "_quake" entry in their settings, we still want it to behave
// like a quake-mode window (docked to the top of the screen, in focus
// mode). If we didn't load one, synthesize a "fake" one that inherits from
// the base window settings but is initialized for quake mode. We keep it out
// of _windows so it isn't serialized back to the user's settings file.
if (!_windows.HasKey(L"_quake"))
{
auto quake{ winrt::make_self<implementation::WindowSettings>() };
quake->Name(L"_quake");
quake->InitializeForQuakeMode();
quake->AddLeastImportantParent(_baseWindowSettings);
quake->_FinalizeInheritance();
_quakeWindowSettings = std::move(quake);
}
_resolveDefaultProfile();
_resolveNewTabMenuProfiles();
_validateSettings();
@@ -1777,6 +1793,11 @@ void CascadiaSettings::_resolveDefaultProfile() const
{
_resolveDefaultProfileForWindow(window, firstProfileGuid);
}
if (_quakeWindowSettings)
{
_resolveDefaultProfileForWindow(*_quakeWindowSettings, firstProfileGuid);
}
}
bool CascadiaSettings::_resolveDefaultProfileForWindow(const Model::WindowSettings& window,
@@ -1809,6 +1830,11 @@ void CascadiaSettings::_resolveNewTabMenuProfiles() const
{
_resolveNewTabMenuProfilesForWindow(window);
}
if (_quakeWindowSettings)
{
_resolveNewTabMenuProfilesForWindow(*_quakeWindowSettings);
}
}
// Method Description: