diff --git a/src/vs/workbench/browser/actions/layoutActions.ts b/src/vs/workbench/browser/actions/layoutActions.ts index ca73beb2038..d6e446d04f1 100644 --- a/src/vs/workbench/browser/actions/layoutActions.ts +++ b/src/vs/workbench/browser/actions/layoutActions.ts @@ -803,7 +803,7 @@ if (isWindows || isLinux || isWeb) { title: localize('miMenuBarNoMnemonic', "Menu Bar"), toggled: ContextKeyExpr.and(IsMacNativeContext.toNegated(), ContextKeyExpr.notEquals('config.window.menuBarVisibility', 'hidden'), ContextKeyExpr.notEquals('config.window.menuBarVisibility', 'toggle'), ContextKeyExpr.notEquals('config.window.menuBarVisibility', 'compact')) }, - when: ContextKeyExpr.and(IsAuxiliaryWindowFocusedContext.toNegated(), ContextKeyExpr.notEquals(TitleBarSetting.TITLE_BAR_STYLE, TitlebarStyle.NATIVE)), + when: ContextKeyExpr.and(IsAuxiliaryWindowFocusedContext.toNegated(), ContextKeyExpr.notEquals(TitleBarSetting.TITLE_BAR_STYLE, TitlebarStyle.NATIVE), IsMainWindowFullscreenContext.negate()), group: '2_config', order: 0 }); diff --git a/src/vs/workbench/browser/layout.ts b/src/vs/workbench/browser/layout.ts index 02d84822c0d..f40144d8cc6 100644 --- a/src/vs/workbench/browser/layout.ts +++ b/src/vs/workbench/browser/layout.ts @@ -347,6 +347,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi LayoutSettings.ACTIVITY_BAR_LOCATION, LayoutSettings.COMMAND_CENTER, LayoutSettings.EDITOR_ACTIONS_LOCATION, + LayoutSettings.LAYOUT_ACTIONS, LegacyWorkbenchLayoutSettings.SIDEBAR_POSITION, LegacyWorkbenchLayoutSettings.STATUSBAR_VISIBLE, 'window.menuBarVisibility', @@ -1229,31 +1230,18 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi return false; } - const nativeTitleBarVisible = hasNativeTitlebar(this.configurationService); + const nativeTitleBarEnabled = hasNativeTitlebar(this.configurationService); const showCustomTitleBar = this.configurationService.getValue(TitleBarSetting.CUSTOM_TITLE_BAR_VISIBILITY); - if (showCustomTitleBar === CustomTitleBarVisibility.NEVER && nativeTitleBarVisible || showCustomTitleBar === CustomTitleBarVisibility.WINDOWED && this.state.runtime.mainWindowFullscreen) { + if (showCustomTitleBar === CustomTitleBarVisibility.NEVER && nativeTitleBarEnabled || showCustomTitleBar === CustomTitleBarVisibility.WINDOWED && this.state.runtime.mainWindowFullscreen) { return false; } - // with the command center enabled, we should always show - if (this.configurationService.getValue(LayoutSettings.COMMAND_CENTER)) { - return true; - } - - // with the activity bar on top, we should always show - if (this.configurationService.getValue(LayoutSettings.ACTIVITY_BAR_LOCATION) === ActivityBarPosition.TOP) { - return true; - } - - // with the editor actions on top, we should always show - const editorActionsLocation = this.configurationService.getValue(LayoutSettings.EDITOR_ACTIONS_LOCATION); - const editorTabsMode = this.configurationService.getValue(LayoutSettings.EDITOR_TABS_MODE); - if (editorActionsLocation === EditorActionsLocation.TITLEBAR || editorActionsLocation === EditorActionsLocation.DEFAULT && editorTabsMode === EditorTabsMode.NONE) { + if (!this.isTitleBarEmpty(nativeTitleBarEnabled)) { return true; } // Hide custom title bar when native title bar and custom title bar is empty - if (nativeTitleBarVisible) { + if (nativeTitleBarEnabled) { return false; } @@ -1288,6 +1276,32 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi } } + private isTitleBarEmpty(nativeTitleBarEnabled: boolean): boolean { + // with the command center enabled, we should always show + if (this.configurationService.getValue(LayoutSettings.COMMAND_CENTER)) { + return false; + } + + // with the activity bar on top, we should always show + if (this.configurationService.getValue(LayoutSettings.ACTIVITY_BAR_LOCATION) === ActivityBarPosition.TOP) { + return false; + } + + // with the editor actions on top, we should always show + const editorActionsLocation = this.configurationService.getValue(LayoutSettings.EDITOR_ACTIONS_LOCATION); + const editorTabsMode = this.configurationService.getValue(LayoutSettings.EDITOR_TABS_MODE); + if (editorActionsLocation === EditorActionsLocation.TITLEBAR || editorActionsLocation === EditorActionsLocation.DEFAULT && editorTabsMode === EditorTabsMode.NONE) { + return false; + } + + // Layout don't show with native title bar + if (!nativeTitleBarEnabled && this.configurationService.getValue(LayoutSettings.LAYOUT_ACTIONS)) { + return false; + } + + return true; + } + private shouldShowBannerFirst(): boolean { return isWeb && !isWCOEnabled(); } diff --git a/src/vs/workbench/browser/parts/titlebar/titlebarActions.ts b/src/vs/workbench/browser/parts/titlebar/titlebarActions.ts index 27937ac6396..e2d88e50c31 100644 --- a/src/vs/workbench/browser/parts/titlebar/titlebarActions.ts +++ b/src/vs/workbench/browser/parts/titlebar/titlebarActions.ts @@ -69,8 +69,7 @@ registerAction2(class ToggleCustomTitleBar extends Action2 { constructor() { super({ id: `toggle.${ToggleCustomTitleBar.settingsID}`, - title: localize('toggle.customTitleBar', 'Custom Title Bar'), - toggled: ContextKeyExpr.true(), + title: localize('toggle.hideCustomTitleBar', 'Hide Custom Title Bar'), menu: [ { id: MenuId.TitleBarContext, order: 0, when: ContextKeyExpr.equals(TitleBarSetting.TITLE_BAR_STYLE, TitlebarStyle.NATIVE), group: '3_toggle' }, ] @@ -84,13 +83,12 @@ registerAction2(class ToggleCustomTitleBar extends Action2 { }); registerAction2(class ToggleCustomTitleBarWindowed extends Action2 { - static readonly settingsID = TitleBarSetting.TITLE_BAR_STYLE; + static readonly settingsID = TitleBarSetting.CUSTOM_TITLE_BAR_VISIBILITY; constructor() { super({ id: `toggle.${ToggleCustomTitleBarWindowed.settingsID}.windowed`, - title: localize('toggle.customTitleBarWindowed', 'Custom Title Bar In Full Screen'), - toggled: ContextKeyExpr.true(), + title: localize('toggle.hideCustomTitleBarInFullScreen', 'Hide Custom Title Bar In Full Screen'), menu: [ { id: MenuId.TitleBarContext, order: 0, when: IsMainWindowFullscreenContext, group: '3_toggle' }, ] diff --git a/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts b/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts index 32361f3be14..2f90f198a36 100644 --- a/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts +++ b/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts @@ -322,7 +322,7 @@ export class BrowserTitlebarPart extends Part implements ITitlebarPart { // Actions if (hasCustomTitlebar(this.configurationService, this.titleBarStyle) && this.actionToolBar) { - const affectsLayoutControl = event.affectsConfiguration('workbench.layoutControl.enabled'); + const affectsLayoutControl = event.affectsConfiguration(LayoutSettings.LAYOUT_ACTIONS); const affectsActivityControl = event.affectsConfiguration(LayoutSettings.ACTIVITY_BAR_LOCATION); if (affectsLayoutControl || affectsActivityControl) { @@ -699,7 +699,7 @@ export class BrowserTitlebarPart extends Part implements ITitlebarPart { } private get layoutControlEnabled(): boolean { - return !this.isAuxiliary && this.configurationService.getValue('workbench.layoutControl.enabled') !== false && !hasNativeTitlebar(this.configurationService, this.titleBarStyle); + return !this.isAuxiliary && this.configurationService.getValue(LayoutSettings.LAYOUT_ACTIONS) !== false && !hasNativeTitlebar(this.configurationService, this.titleBarStyle); } protected get isCommandCenterVisible() { @@ -710,7 +710,7 @@ export class BrowserTitlebarPart extends Part implements ITitlebarPart { return this.editorGroupService.partOptions.editorActionsLocation === EditorActionsLocation.TITLEBAR || ( this.editorGroupService.partOptions.editorActionsLocation === EditorActionsLocation.DEFAULT && - this.editorGroupService.partOptions.showTabs === EditorTabsMode.MULTIPLE + this.editorGroupService.partOptions.showTabs === EditorTabsMode.NONE ); } diff --git a/src/vs/workbench/browser/workbench.contribution.ts b/src/vs/workbench/browser/workbench.contribution.ts index 869b35f9572..6153d527c98 100644 --- a/src/vs/workbench/browser/workbench.contribution.ts +++ b/src/vs/workbench/browser/workbench.contribution.ts @@ -566,7 +566,7 @@ const registry = Registry.as(ConfigurationExtensions.Con tags: ['accessibility'], enum: ['on', 'off', 'auto'] }, - 'workbench.layoutControl.enabled': { + [LayoutSettings.LAYOUT_ACTIONS]: { 'type': 'boolean', 'default': true, 'markdownDescription': isWeb ? diff --git a/src/vs/workbench/services/layout/browser/layoutService.ts b/src/vs/workbench/services/layout/browser/layoutService.ts index c64f875ded0..c1091f8e7a6 100644 --- a/src/vs/workbench/services/layout/browser/layoutService.ts +++ b/src/vs/workbench/services/layout/browser/layoutService.ts @@ -39,6 +39,7 @@ export const enum LayoutSettings { EDITOR_TABS_MODE = 'workbench.editor.showTabs', EDITOR_ACTIONS_LOCATION = 'workbench.editor.editorActionsLocation', COMMAND_CENTER = 'window.commandCenter', + LAYOUT_ACTIONS = 'workbench.layoutControl.enabled', } export const enum ActivityBarPosition {