diff --git a/src/cascadia/TerminalApp/TerminalWindow.cpp b/src/cascadia/TerminalApp/TerminalWindow.cpp index bd246bb53d..749fd2e842 100644 --- a/src/cascadia/TerminalApp/TerminalWindow.cpp +++ b/src/cascadia/TerminalApp/TerminalWindow.cpp @@ -562,9 +562,21 @@ namespace winrt::TerminalApp::implementation { winrt::Windows::Foundation::Size proposedSize{}; + // In focus mode, we don't want to include our own tab row in the size + // of the window that we hand back. So we account for passing + // --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.GetLaunchMode().value_or(_settings.GlobalSettings().LaunchMode()) == LaunchMode::FocusMode; + const auto scale = static_cast(dpi) / static_cast(USER_DEFAULT_SCREEN_DPI); if (const auto layout = LoadPersistedLayout()) { + if (layout.LaunchMode()) + { + focusMode = layout.LaunchMode().Value() == LaunchMode::FocusMode; + } + if (layout.InitialSize()) { proposedSize = layout.InitialSize().Value(); @@ -602,7 +614,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()) + if (_settings.GlobalSettings().ShowTabsInTitlebar() && !focusMode) { // In the past, we used to actually instantiate a TitlebarControl // and use Measure() to determine the DesiredSize of the control, to @@ -620,7 +632,7 @@ namespace winrt::TerminalApp::implementation static constexpr auto titlebarHeight = 40; proposedSize.Height += (titlebarHeight)*scale; } - else if (_settings.GlobalSettings().AlwaysShowTabs()) + else if (_settings.GlobalSettings().AlwaysShowTabs() && !focusMode) { // Same comment as above, but with a TabRowControl. //