Skip to content

Commit 2857051

Browse files
authored
Titlebar overlay is not enabled (fix microsoft#158203) (microsoft#158251)
1 parent 4b6ccd8 commit 2857051

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

src/vs/platform/window/common/window.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,16 +165,20 @@ export function getTitleBarStyle(configurationService: IConfigurationService): '
165165
}
166166

167167
export function useWindowControlsOverlay(configurationService: IConfigurationService, environmentService: IEnvironmentService): boolean {
168-
// Window Controls Overlay are only configurable on Windows
169168
if (!isWindows || isWeb || !environmentService.isBuilt) {
170-
return false;
169+
return false; // only supported on a built desktop windows instance
171170
}
172171

173172
if (getTitleBarStyle(configurationService) === 'native') {
174-
return false;
173+
return false; // only supported when title bar is custom
175174
}
176175

177-
return configurationService.getValue<boolean>('window.experimental.windowControlsOverlay.enabled');
176+
const configuredUseWindowControlsOverlay = configurationService.getValue<boolean | undefined>('window.experimental.windowControlsOverlay.enabled');
177+
if (typeof configuredUseWindowControlsOverlay === 'boolean') {
178+
return configuredUseWindowControlsOverlay;
179+
}
180+
181+
return true; // enabled by default
178182
}
179183

180184
export interface IPath<T = IEditorOptions> extends IPathData<T> {

src/vs/platform/windows/electron-main/windowImpl.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ export class CodeWindow extends Disposable implements ICodeWindow {
143143
private representedFilename: string | undefined;
144144
private documentEdited: boolean | undefined;
145145

146+
private readonly hasWindowControlOverlay: boolean = false;
147+
146148
private readonly whenReadyCallbacks: { (window: ICodeWindow): void }[] = [];
147149

148150
private readonly touchBarGroups: TouchBarSegmentedControl[] = [];
@@ -280,6 +282,8 @@ export class CodeWindow extends Disposable implements ICodeWindow {
280282
color: titleBarColor,
281283
symbolColor
282284
};
285+
286+
this.hasWindowControlOverlay = true;
283287
}
284288
}
285289

@@ -1072,7 +1076,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
10721076
}
10731077

10741078
// Windows: window control overlay (WCO)
1075-
if (isWindows && useWindowControlsOverlay(this.configurationService, this.environmentMainService)) {
1079+
if (isWindows && this.hasWindowControlOverlay) {
10761080
this._win.setTitleBarOverlay({
10771081
color: options.backgroundColor?.trim() === '' ? undefined : options.backgroundColor,
10781082
symbolColor: options.foregroundColor?.trim() === '' ? undefined : options.foregroundColor,

0 commit comments

Comments
 (0)