diff --git a/src/vs/base/browser/browser.ts b/src/vs/base/browser/browser.ts index d41cafcd..cf70d65e 100644 --- a/src/vs/base/browser/browser.ts +++ b/src/vs/base/browser/browser.ts @@ -205,3 +205,10 @@ if (window.matchMedia) { export function isStandalone(): boolean { return standalone; } + +// Visible means that the feature is enabled, not necessarily being rendered +// e.g. visible is true even in fullscreen mode where the controls are hidden +// See docs at https://developer.mozilla.org/en-US/docs/Web/API/WindowControlsOverlay/visible +export function isWCOEnabled(): boolean { + return (navigator as any)?.windowControlsOverlay?.visible; +} diff --git a/src/vs/workbench/electron-sandbox/parts/titlebar/titlebarPart.ts b/src/vs/workbench/electron-sandbox/parts/titlebar/titlebarPart.ts index e4f9c4f5..227de2c0 100644 --- a/src/vs/workbench/electron-sandbox/parts/titlebar/titlebarPart.ts +++ b/src/vs/workbench/electron-sandbox/parts/titlebar/titlebarPart.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { getZoomFactor } from 'vs/base/browser/browser'; +import { getZoomFactor, isWCOEnabled } from 'vs/base/browser/browser'; import { $, addDisposableListener, append, EventType, hide, prepend, show } from 'vs/base/browser/dom'; import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { IConfigurationService, IConfigurationChangeEvent } from 'vs/platform/configuration/common/configuration'; @@ -155,10 +155,8 @@ export class TitlebarPart extends BrowserTitleBarPart { // Draggable region that we can manipulate for #52522 this.dragRegion = prepend(this.rootContainer, $('div.titlebar-drag-region')); - // Window Controls (Native Windows/Linux) - const hasWindowControlsOverlay = typeof (navigator as any).windowControlsOverlay !== 'undefined'; - if (!isMacintosh && getTitleBarStyle(this.configurationService) !== 'native' && !hasWindowControlsOverlay && this.windowControls) { + if (!isMacintosh && getTitleBarStyle(this.configurationService) !== 'native' && !isWCOEnabled() && this.windowControls) { // Minimize const minimizeIcon = append(this.windowControls, $('div.window-icon.window-minimize' + Codicon.chromeMinimize.cssSelector)); this._register(addDisposableListener(minimizeIcon, EventType.CLICK, e => {