Skip to content

Commit e670090

Browse files
authored
macOS - tweak traffic light position handling (microsoft#155558)
//cc @jrieken
1 parent 36f1463 commit e670090

File tree

1 file changed

+9
-3
lines changed
  • src/vs/platform/windows/electron-main

1 file changed

+9
-3
lines changed

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { app, BrowserWindow, BrowserWindowConstructorOptions, Display, Event, nativeImage, NativeImage, Rectangle, screen, SegmentedControlSegment, systemPreferences, TouchBar, TouchBarSegmentedControl } from 'electron';
6+
import { app, BrowserWindow, BrowserWindowConstructorOptions, Display, Event, nativeImage, NativeImage, Point, Rectangle, screen, SegmentedControlSegment, systemPreferences, TouchBar, TouchBarSegmentedControl } from 'electron';
77
import { RunOnceScheduler } from 'vs/base/common/async';
88
import { CancellationToken } from 'vs/base/common/cancellation';
99
import { toErrorMessage } from 'vs/base/common/errorMessage';
@@ -141,6 +141,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
141141
private documentEdited: boolean | undefined;
142142

143143
private customTrafficLightPosition: boolean | undefined;
144+
private defaultTrafficLightPosition: Point | undefined;
144145

145146
private readonly whenReadyCallbacks: { (window: ICodeWindow): void }[] = [];
146147

@@ -1325,9 +1326,14 @@ export class CodeWindow extends Disposable implements ICodeWindow {
13251326

13261327
const useCustomTrafficLightPosition = this.configurationService.getValue<boolean>(commandCenterSettingKey);
13271328
if (useCustomTrafficLightPosition) {
1328-
this._win.setTrafficLightPosition({ x: 7, y: 9 });
1329+
if (!this.defaultTrafficLightPosition) {
1330+
this.defaultTrafficLightPosition = this._win.getTrafficLightPosition(); // remember default to restore later
1331+
}
1332+
this._win.setTrafficLightPosition({ x: 7, y: 10 });
13291333
} else {
1330-
this._win.setTrafficLightPosition({ x: 7, y: 6 });
1334+
if (this.defaultTrafficLightPosition) {
1335+
this._win.setTrafficLightPosition(this.defaultTrafficLightPosition);
1336+
}
13311337
}
13321338

13331339
this.customTrafficLightPosition = useCustomTrafficLightPosition;

0 commit comments

Comments
 (0)