diff --git a/doc/cascadia/profiles.schema.json b/doc/cascadia/profiles.schema.json index 9d5bd545686..fc300a49499 100644 --- a/doc/cascadia/profiles.schema.json +++ b/doc/cascadia/profiles.schema.json @@ -1348,7 +1348,7 @@ "properties": { "acrylicOpacity": { "default": 0.5, - "description": "When useAcrylic is set to true, it sets the transparency of the window for the profile. Accepts floating point values from 0-1 (default 0.5).", + "description": "[deprecated] Please use `opacity` instead.", "maximum": 1, "minimum": 0, "type": "number" @@ -1561,6 +1561,14 @@ "minLength": 1, "type": "string" }, + + "opacity": { + "default": 100, + "description": "Sets the opacity of the window for the profile. Accepts values from 0-100. Defaults to 50 when useAcrylic is set to true.", + "maximum": 100, + "minimum": 0, + "type": "number" + }, "padding": { "default": "8, 8, 8, 8", "description": "Sets the padding around the text within the window. Can have three different formats:\n -\"#\" sets the same padding for all sides \n -\"#, #\" sets the same padding for left-right and top-bottom\n -\"#, #, #, #\" sets the padding individually for left, top, right, and bottom.", diff --git a/src/cascadia/TerminalControl/TermControl.cpp b/src/cascadia/TerminalControl/TermControl.cpp index 2f80c0a2dcb..e08fcdb18aa 100644 --- a/src/cascadia/TerminalControl/TermControl.cpp +++ b/src/cascadia/TerminalControl/TermControl.cpp @@ -495,10 +495,9 @@ namespace winrt::Microsoft::Terminal::Control::implementation } else if (auto solidColor = RootGrid().Background().try_as()) { - auto originalOpacity = solidColor.Opacity(); + const auto originalOpacity = solidColor.Opacity(); solidColor.Color(bg); solidColor.Opacity(originalOpacity); - // solidColor.Color(til::color{bg.r, bg.g, bg.b, base::saturated_cast(255 * originalOpacity)}) } } } diff --git a/src/cascadia/TerminalSettingsModel/TerminalSettings.cpp b/src/cascadia/TerminalSettingsModel/TerminalSettings.cpp index 9478ebecdef..e52c250d1cb 100644 --- a/src/cascadia/TerminalSettingsModel/TerminalSettings.cpp +++ b/src/cascadia/TerminalSettingsModel/TerminalSettings.cpp @@ -202,7 +202,15 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation _IntenseIsBold = WI_IsFlagSet(appearance.IntenseTextStyle(), Microsoft::Terminal::Settings::Model::IntenseStyle::Bold); _IntenseIsBright = WI_IsFlagSet(appearance.IntenseTextStyle(), Microsoft::Terminal::Settings::Model::IntenseStyle::Bright); - _Opacity = appearance.Opacity(); + // If the user set an opacity, then just use that. Otherwise, change the + // default value based off of whether useAcrylic was set or not. If they + // want acrylic, then default to 50%. Otherwise, default to 100% (fully + // opaque) + _Opacity = appearance.HasOpacity() ? + appearance.Opacity() : + UseAcrylic() ? + .5 : + 1.0; } // Method Description: diff --git a/src/cascadia/WindowsTerminal/NonClientIslandWindow.cpp b/src/cascadia/WindowsTerminal/NonClientIslandWindow.cpp index face7082867..75ef888eb0a 100644 --- a/src/cascadia/WindowsTerminal/NonClientIslandWindow.cpp +++ b/src/cascadia/WindowsTerminal/NonClientIslandWindow.cpp @@ -687,6 +687,11 @@ void NonClientIslandWindow::_UpdateFrameMargins() const noexcept { MARGINS margins = { 0, 0, 0, 0 }; + // GH#603: When we're in Focus Mode, hide the titlebar, by setting it to a single + // pixel tall. Otherwise, the titlebar will be visible underneath controls with + // vintage opacity set. + // + // We can't set it to all 0's unfortunately. if (_borderless) { margins.cyTopHeight = 1; @@ -900,14 +905,8 @@ void NonClientIslandWindow::_SetIsBorderless(const bool borderlessEnabled) _titlebar.Visibility(_IsTitlebarVisible() ? Visibility::Visible : Visibility::Collapsed); } - // These are all useless. - // auto windowStyle = GetWindowLongW(GetHandle(), GWL_STYLE); - // WI_ClearAllFlags(windowStyle, WS_OVERLAPPEDWINDOW); - // WI_SetFlag(windowStyle, WS_SIZEBOX); - // // WI_SetFlag(windowStyle, WS_BORDER); - // WI_SetFlag(windowStyle, WS_POPUP); - // SetWindowLongWHelper(GetHandle(), GWL_STYLE, windowStyle); - + // Update the margins when entering/leaving focus mode, so we can prevent + // the titlebar from showing through transparent terminal controls _UpdateFrameMargins(); // GH#4224 - When the auto-hide taskbar setting is enabled, then we don't