Permalink
Browse files

use systemPreferences.setUserDefault() to workaround #35361

  • Loading branch information...
bpasero committed Jun 26, 2018
1 parent 6a59181 commit 368ab9c31b5c0930a40ab3f0e0d768ebbeeb9ef8
Showing with 16 additions and 2 deletions.
  1. +16 −2 src/vs/code/electron-main/app.ts
@@ -5,7 +5,7 @@

'use strict';

import { app, ipcMain as ipc } from 'electron';
import { app, ipcMain as ipc, systemPreferences } from 'electron';
import * as platform from 'vs/base/common/platform';
import { WindowsManager } from 'vs/code/electron-main/windows';
import { IWindowsService, OpenContext, ActiveWindowManager } from 'vs/platform/windows/common/windows';
@@ -85,7 +85,7 @@ export class CodeApplication {
@ILogService private logService: ILogService,
@IEnvironmentService private environmentService: IEnvironmentService,
@ILifecycleService private lifecycleService: ILifecycleService,
@IConfigurationService configurationService: ConfigurationService,
@IConfigurationService private configurationService: ConfigurationService,
@IStateService private stateService: IStateService,
@IHistoryMainService private historyMainService: IHistoryMainService
) {
@@ -274,6 +274,20 @@ export class CodeApplication {
app.setAppUserModelId(product.win32AppUserModelId);
}

// Fix native tabs on macOS 10.13
// macOS enables a compatibility patch for any bundle ID beginning with
// "com.microsoft.", which breaks native tabs for VS Code when using this
// identifier (from the official build).
// Explicitly opt out of the patch here before creating any windows.
// See: https://github.com/Microsoft/vscode/issues/35361#issuecomment-399794085
try {
if (platform.isMacintosh && this.configurationService.getValue<boolean>('window.nativeTabs') === true && !systemPreferences.getUserDefault('NSUseImprovedLayoutPass', 'boolean')) {
systemPreferences.setUserDefault('NSUseImprovedLayoutPass', 'boolean', true as any);
}
} catch (error) {
this.logService.error(error);
}

// Create Electron IPC Server
this.electronIpcServer = new ElectronIPCServer();

0 comments on commit 368ab9c

Please sign in to comment.