Skip to content

Commit

Permalink
WIP on moving the inline toolbar behind a feature flag
Browse files Browse the repository at this point in the history
  • Loading branch information
orta committed Sep 26, 2016
1 parent 43f60bc commit 13e6e69
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
13 changes: 12 additions & 1 deletion src/vs/code/electron-main/window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export interface IWindowCreationOptions {
state: IWindowState;
extensionDevelopmentPath?: string;
allowFullscreen?: boolean;
macOSUseInlineToolbar: boolean;
}

export enum WindowMode {
Expand Down Expand Up @@ -106,6 +107,7 @@ export interface IWindowSettings {
reopenFolders: 'all' | 'one' | 'none';
restoreFullscreen: boolean;
zoomLevel: number;
macOSUseInlineToolbar: boolean;
}

export class VSCodeWindow {
Expand Down Expand Up @@ -169,13 +171,17 @@ export class VSCodeWindow {
webPreferences: {
'backgroundThrottling': false // by default if Code is in the background, intervals and timeouts get throttled
},
titleBarStyle: 'hidden-inset'
};

if (platform.isLinux) {
options.icon = path.join(this.envService.appRoot, 'resources/linux/code.png'); // Windows and Mac are better off using the embedded icon(s)
}

// TODO: Orta - this is not working
if (platform.isMacintosh && this.options.macOSUseInlineToolbar) {
options.titleBarStyle = 'hidden-inset';
}

// Create the browser window.
this._win = new BrowserWindow(options);
this._id = this._win.id;
Expand Down Expand Up @@ -347,6 +353,11 @@ export class VSCodeWindow {
}
});
}

if (this.options.macOSUseInlineToolbar) {
this.sendWhenReady('vscode:macOSUseInlineToolbar');
}

}

public load(config: IWindowConfiguration): void {
Expand Down
3 changes: 2 additions & 1 deletion src/vs/code/electron-main/windows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,8 @@ export class WindowsManager implements IWindowsService {
vscodeWindow = this.instantiationService.createInstance(VSCodeWindow, {
state: this.getNewWindowState(configuration),
extensionDevelopmentPath: configuration.extensionDevelopmentPath,
allowFullscreen: this.lifecycleService.wasUpdated || (windowConfig && windowConfig.restoreFullscreen)
allowFullscreen: this.lifecycleService.wasUpdated || (windowConfig && windowConfig.restoreFullscreen),
macOSUseInlineToolbar: windowConfig.macOSUseInlineToolbar
});

WindowsManager.WINDOWS.push(vscodeWindow);
Expand Down
7 changes: 7 additions & 0 deletions src/vs/workbench/electron-browser/integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,13 @@ export class ElectronIntegration {
});
});

ipc.on('vscode:macOSUseInlineToolbar', (event) => {
this.partService.joinCreation().then(() => {
this.partService.addClass('use-inline-toolbar');
this.partService.setSideBarPosition(this.partService.getSideBarPosition());
});
});

// Ensure others can listen to zoom level changes
browser.setZoomLevel(webFrame.getZoomLevel());

Expand Down
5 changes: 5 additions & 0 deletions src/vs/workbench/electron-browser/main.contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@ configurationRegistry.registerConfiguration({
'type': 'number',
'default': 0,
'description': nls.localize('zoomLevel', "Adjust the zoom level of the window. The original size is 0 and each increment above (e.g. 1) or below (e.g. -1) represents zooming 20% larger or smaller. You can also enter decimals to adjust the zoom level with a finer granularity.")
},
'window.macOSUseInlineToolbar': {
'type': 'boolean',
'default': false,
'description': nls.localize('macOSUseInlineToolbar', "Use an inline toolbar style on macOS. Note changes require a full restart to apply.")
}
}
});
Expand Down

0 comments on commit 13e6e69

Please sign in to comment.