diff --git a/src/vs/code/electron-main/window.ts b/src/vs/code/electron-main/window.ts index a26de77fea4db4c930bbeebe75e60bec24dabb9d..085f6b48f6517fbeb75611818ad387addcf94f4b 100644 --- a/src/vs/code/electron-main/window.ts +++ b/src/vs/code/electron-main/window.ts @@ -656,8 +656,10 @@ export class VSCodeWindow implements IVSCodeWindow { } public setMenuBarVisibility(visible: boolean): void { + const windowConfig = this.configurationService.getConfiguration('window'); + this.win.setMenuBarVisibility(visible); - this.win.setAutoHideMenuBar(!visible); + this.win.setAutoHideMenuBar(windowConfig && windowConfig.autoHideMenuBar ? !visible : false); } public sendWhenReady(channel: string, ...args: any[]): void { diff --git a/src/vs/code/electron-main/windows.ts b/src/vs/code/electron-main/windows.ts index 7735e5d527f7b0e79b447797b975c5634813e1a2..32f4912623c85a88b3a14a457d79213365aa626e 100644 --- a/src/vs/code/electron-main/windows.ts +++ b/src/vs/code/electron-main/windows.ts @@ -1144,13 +1144,16 @@ export class WindowsManager implements IWindowsMainService { // Update in settings const menuBarHidden = this.storageService.getItem(VSCodeWindow.menuBarHiddenKey, false); const newMenuBarHidden = !menuBarHidden; + + const windowConfig = this.configurationService.getConfiguration('window'); + this.storageService.setItem(VSCodeWindow.menuBarHiddenKey, newMenuBarHidden); // Update across windows WindowsManager.WINDOWS.forEach(w => w.setMenuBarVisibility(!newMenuBarHidden)); // Inform user if menu bar is now hidden - if (newMenuBarHidden) { + if (newMenuBarHidden && windowConfig && windowConfig.autoHideMenuBar) { const vscodeWindow = this.getWindowById(windowId); if (vscodeWindow) { vscodeWindow.send('vscode:showInfoMessage', nls.localize('hiddenMenuBar', "You can still access the menu bar by pressing the **Alt** key.")); diff --git a/src/vs/platform/windows/common/windows.ts b/src/vs/platform/windows/common/windows.ts index f978e32945f382997509f251f8997704341b694f..07efadf2d823a53d038c084a0ef68ec19c0e7233 100644 --- a/src/vs/platform/windows/common/windows.ts +++ b/src/vs/platform/windows/common/windows.ts @@ -94,4 +94,5 @@ export interface IWindowSettings { zoomLevel: number; titleBarStyle: 'native' | 'custom'; autoDetectHighContrast: boolean; + autoHideMenuBar: boolean; } diff --git a/src/vs/workbench/electron-browser/main.contribution.ts b/src/vs/workbench/electron-browser/main.contribution.ts index 53fd98f68819fa09efb6457f954b128df91f188e..e80fed6b32599b75733f4fd4c6473eb189c7b32c 100644 --- a/src/vs/workbench/electron-browser/main.contribution.ts +++ b/src/vs/workbench/electron-browser/main.contribution.ts @@ -200,6 +200,11 @@ let properties: { [path: string]: IJSONSchema; } = { 'type': 'boolean', 'default': false, 'description': nls.localize('showFullPath', "If enabled, will show the full path of opened files in the window title.") + }, + 'window.autoHideMenuBar': { + 'type': 'boolean', + 'default': true, + 'description': nls.localize('autoHideMenuBar', "If set to false, the menu bar will no longer be shown when pressing the alt key (linux / windows only)") } }; @@ -226,4 +231,4 @@ configurationRegistry.registerConfiguration({ 'title': nls.localize('windowConfigurationTitle', "Window"), 'type': 'object', 'properties': properties -}); \ No newline at end of file +});