Repository: microsoft/terminal
File: src/cascadia/TerminalApp/TerminalPage.cpp (C++)

Code before:
        // startup actions. Things like Panes need to know at least how big the
        // window will be, so they can subdivide that space.
        //
        // _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();

        // DON'T set up Toasts/TeachingTips here. They should be loaded and
        // initialized the first time they're opened, in whatever method opens
        // them.

        // Setup mouse vanish attributes
        SystemParametersInfoW(SPI_GETMOUSEVANISH, 0, &_shouldMouseVanish, false);

        _tabRow.ShowElevationShield(IsElevated() && _settings.GlobalSettings().ShowAdminShield());

        // Store cursor, so we can restore it, e.g., after mouse vanishing
        // (we'll need to adapt this logic once we make cursor context aware)
        try
        {
            _defaultPointerCursor = CoreWindow::GetForCurrentThread().PointerCursor();
        }
        CATCH_LOG();

        if (CascadiaSettings::IsDefaultTerminalAvailable())
        {
            ShowSetAsDefaultInfoBar();
        }
    }

    // Method Description;
    // - Checks if the current terminal window should load or save its layout information.
    // Arguments:
    // - settings: The settings to use as this may be called before the page is
    //   fully initialized.
    // Return Value:
    // - true if the ApplicationState should be used.
    bool TerminalPage::ShouldUsePersistedLayout(CascadiaSettings& settings) const
    {
        // GH#5000 Until there is a separate state file for elevated sessions we should just not
        // save at all while in an elevated window.
        return Feature_PersistedWindowLayout::IsEnabled() &&
               !IsElevated() &&
               settings.GlobalSettings().FirstWindowPreference() == FirstWindowPreference::PersistedWindowLayout;
    }

    // Method Description;
    // - Checks if the current window is configured to load a particular layout
    // Arguments:
    // - settings: The settings to use as this may be called before the page is

Review comment (suggestion):
I wanted to add a check here that only makes it show up if conhost is the current default:
```cpp
if (CascadiaSettings::IsDefaultTerminalAvailable() && !_settings.CurrentDefaultTerminal())
```

But unfortunately the `Name()` returned by `CurrentDefaultTerminal()` is always a localized name of the application including conhost. So I'd have to add some new API functions to make this work.

But before I do that I wanted to ask if anyone else would like to see that...

Code after:
        // startup actions. Things like Panes need to know at least how big the
        // window will be, so they can subdivide that space.
        //
        // _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();

        // DON'T set up Toasts/TeachingTips here. They should be loaded and
        // initialized the first time they're opened, in whatever method opens
        // them.

        // Setup mouse vanish attributes
        SystemParametersInfoW(SPI_GETMOUSEVANISH, 0, &_shouldMouseVanish, false);

        _tabRow.ShowElevationShield(IsElevated() && _settings.GlobalSettings().ShowAdminShield());

        // Store cursor, so we can restore it, e.g., after mouse vanishing
        // (we'll need to adapt this logic once we make cursor context aware)
        try
        {
            _defaultPointerCursor = CoreWindow::GetForCurrentThread().PointerCursor();
        }
        CATCH_LOG();

        ShowSetAsDefaultInfoBar();
    }

    // Method Description;
    // - Checks if the current terminal window should load or save its layout information.
    // Arguments:
    // - settings: The settings to use as this may be called before the page is
    //   fully initialized.
    // Return Value:
    // - true if the ApplicationState should be used.
    bool TerminalPage::ShouldUsePersistedLayout(CascadiaSettings& settings) const
    {
        // GH#5000 Until there is a separate state file for elevated sessions we should just not
        // save at all while in an elevated window.
        return Feature_PersistedWindowLayout::IsEnabled() &&
               !IsElevated() &&
               settings.GlobalSettings().FirstWindowPreference() == FirstWindowPreference::PersistedWindowLayout;
    }

    // Method Description;
    // - Checks if the current window is configured to load a particular layout
    // Arguments:
    // - settings: The settings to use as this may be called before the page is
    //   fully initialized.
    // Return Value:
    // - non-null if there is a particular saved layout to use