mirror of
https://github.com/microsoft/terminal.git
synced 2026-09-24 16:05:21 +00:00
This was my prototyped fix for the crash, but uuhhhhggggggg
This commit is contained in:
@@ -1472,6 +1472,11 @@ namespace winrt::TerminalApp::implementation
|
||||
return _root != nullptr ? _root->ShouldUsePersistedLayout(_settings) : false;
|
||||
}
|
||||
|
||||
bool AppLogic::ShouldActuallySpawnPersistedLayouts()
|
||||
{
|
||||
return _root != nullptr ? _root->ShouldActuallySpawnPersistedLayouts() : false;
|
||||
}
|
||||
|
||||
void AppLogic::SaveWindowLayoutJsons(const Windows::Foundation::Collections::IVector<hstring>& layouts)
|
||||
{
|
||||
std::vector<WindowLayout> converted;
|
||||
|
||||
@@ -81,6 +81,7 @@ namespace winrt::TerminalApp::implementation
|
||||
bool AlwaysOnTop() const;
|
||||
|
||||
bool ShouldUsePersistedLayout();
|
||||
bool ShouldActuallySpawnPersistedLayouts();
|
||||
hstring GetWindowLayoutJson(Microsoft::Terminal::Settings::Model::LaunchPosition position);
|
||||
void SaveWindowLayoutJsons(const Windows::Foundation::Collections::IVector<hstring>& layouts);
|
||||
void IdentifyWindow();
|
||||
|
||||
@@ -93,6 +93,7 @@ namespace TerminalApp
|
||||
TaskbarState TaskbarState{ get; };
|
||||
|
||||
Boolean ShouldUsePersistedLayout();
|
||||
Boolean ShouldActuallySpawnPersistedLayouts();
|
||||
String GetWindowLayoutJson(Microsoft.Terminal.Settings.Model.LaunchPosition position);
|
||||
void SaveWindowLayoutJsons(Windows.Foundation.Collections.IVector<String> layouts);
|
||||
|
||||
|
||||
@@ -302,6 +302,31 @@ namespace winrt::TerminalApp::implementation
|
||||
settings.GlobalSettings().FirstWindowPreference() == FirstWindowPreference::PersistedWindowLayout;
|
||||
}
|
||||
|
||||
bool TerminalPage::ShouldActuallySpawnPersistedLayouts() const
|
||||
{
|
||||
if (!_startupActions || IsElevated())
|
||||
{
|
||||
// there arent startup actions, or we're elevated. In that case, go for it.
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check that there's at least one action that's not just an elevated newTab action.
|
||||
for (const auto& action : _startupActions)
|
||||
{
|
||||
if (action.Action() == ShortcutAction::NewTab)
|
||||
{
|
||||
const auto& args{ action.Args().try_as<NewTabArgs>() };
|
||||
if (args && args.TerminalArgs().Elevate())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Method Description;
|
||||
// - Checks if the current window is configured to load a particular layout
|
||||
// Arguments:
|
||||
|
||||
@@ -64,6 +64,7 @@ namespace winrt::TerminalApp::implementation
|
||||
void Create();
|
||||
|
||||
bool ShouldUsePersistedLayout(Microsoft::Terminal::Settings::Model::CascadiaSettings& settings) const;
|
||||
bool ShouldActuallySpawnPersistedLayouts() const;
|
||||
std::optional<uint32_t> LoadPersistedLayoutIdx(Microsoft::Terminal::Settings::Model::CascadiaSettings& settings) const;
|
||||
winrt::Microsoft::Terminal::Settings::Model::WindowLayout LoadPersistedLayout(Microsoft::Terminal::Settings::Model::CascadiaSettings& settings) const;
|
||||
Microsoft::Terminal::Settings::Model::WindowLayout GetWindowLayout();
|
||||
|
||||
@@ -231,7 +231,10 @@ void AppHost::_HandleCommandlineArgs()
|
||||
{
|
||||
const auto numPeasants = _windowManager.GetNumberOfPeasants();
|
||||
const auto layouts = ApplicationState::SharedInstance().PersistedWindowLayouts();
|
||||
if (_logic.ShouldUsePersistedLayout() && layouts && layouts.Size() > 0)
|
||||
if (_logic.ShouldUsePersistedLayout() &&
|
||||
layouts &&
|
||||
layouts.Size() > 0 &&
|
||||
_logic.ShouldActuallySpawnPersistedLayouts())
|
||||
{
|
||||
uint32_t startIdx = 0;
|
||||
// We want to create a window for every saved layout.
|
||||
|
||||
Reference in New Issue
Block a user