Skip to content

Commit 639c4c8

Browse files
authored
Make title bar and command center visible when actions are enabled (microsoft#236369)
Make title bar and or command center visible when actions are enabled in title bar
1 parent 68410e1 commit 639c4c8

File tree

1 file changed

+28
-9
lines changed

1 file changed

+28
-9
lines changed

src/vs/workbench/browser/layout.ts

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,18 @@ interface IInitialEditorsState {
116116
readonly layout?: EditorGroupLayout;
117117
}
118118

119+
const COMMAND_CENTER_SETTINGS = [
120+
'chat.commandCenter.enabled',
121+
'workbench.navigationControl.enabled',
122+
'workbench.experimental.share.enabled',
123+
];
124+
119125
export const TITLE_BAR_SETTINGS = [
120126
LayoutSettings.ACTIVITY_BAR_LOCATION,
121127
LayoutSettings.COMMAND_CENTER,
128+
...COMMAND_CENTER_SETTINGS,
122129
LayoutSettings.EDITOR_ACTIONS_LOCATION,
123130
LayoutSettings.LAYOUT_ACTIONS,
124-
'workbench.navigationControl.enabled',
125131
'window.menuBarVisibility',
126132
TitleBarSetting.TITLE_BAR_STYLE,
127133
TitleBarSetting.CUSTOM_TITLE_BAR_VISIBILITY,
@@ -355,18 +361,31 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
355361
LegacyWorkbenchLayoutSettings.SIDEBAR_POSITION,
356362
LegacyWorkbenchLayoutSettings.STATUSBAR_VISIBLE,
357363
].some(setting => e.affectsConfiguration(setting))) {
358-
// Show Custom TitleBar if actions moved to the titlebar
359-
const editorActionsMovedToTitlebar = e.affectsConfiguration(LayoutSettings.EDITOR_ACTIONS_LOCATION) && this.configurationService.getValue<EditorActionsLocation>(LayoutSettings.EDITOR_ACTIONS_LOCATION) === EditorActionsLocation.TITLEBAR;
360-
361-
let activityBarMovedToTopOrBottom = false;
362-
if (e.affectsConfiguration(LayoutSettings.ACTIVITY_BAR_LOCATION)) {
363-
const activityBarPosition = this.configurationService.getValue<ActivityBarPosition>(LayoutSettings.ACTIVITY_BAR_LOCATION);
364-
activityBarMovedToTopOrBottom = activityBarPosition === ActivityBarPosition.TOP || activityBarPosition === ActivityBarPosition.BOTTOM;
364+
// Show Command Center if command center actions enabled
365+
const shareEnabled = e.affectsConfiguration('workbench.experimental.share.enabled') && this.configurationService.getValue<boolean>('workbench.experimental.share.enabled');
366+
const navigationControlEnabled = e.affectsConfiguration('workbench.navigationControl.enabled') && this.configurationService.getValue<boolean>('workbench.navigationControl.enabled');
367+
368+
// Currently not supported for "chat.commandCenter.enabled" as we
369+
// programatically set this during setup and could lead to unwanted titlebar appearing
370+
// const chatControlsEnabled = e.affectsConfiguration('chat.commandCenter.enabled') && this.configurationService.getValue<boolean>('chat.commandCenter.enabled');
371+
372+
if (shareEnabled || navigationControlEnabled) {
373+
if (this.configurationService.getValue<boolean>(LayoutSettings.COMMAND_CENTER) === false) {
374+
this.configurationService.updateValue(LayoutSettings.COMMAND_CENTER, true);
375+
return; // onDidChangeConfiguration will be triggered again
376+
}
365377
}
366378

367-
if (activityBarMovedToTopOrBottom || editorActionsMovedToTitlebar) {
379+
// Show Custom TitleBar if actions enabled in (or moved to) the titlebar
380+
const editorActionsMovedToTitlebar = e.affectsConfiguration(LayoutSettings.EDITOR_ACTIONS_LOCATION) && this.configurationService.getValue<EditorActionsLocation>(LayoutSettings.EDITOR_ACTIONS_LOCATION) === EditorActionsLocation.TITLEBAR;
381+
const commandCenterEnabled = e.affectsConfiguration(LayoutSettings.COMMAND_CENTER) && this.configurationService.getValue<boolean>(LayoutSettings.COMMAND_CENTER);
382+
const layoutControlsEnabled = e.affectsConfiguration(LayoutSettings.LAYOUT_ACTIONS) && this.configurationService.getValue<boolean>(LayoutSettings.LAYOUT_ACTIONS);
383+
const activityBarMovedToTopOrBottom = e.affectsConfiguration(LayoutSettings.ACTIVITY_BAR_LOCATION) && [ActivityBarPosition.TOP, ActivityBarPosition.BOTTOM].includes(this.configurationService.getValue<ActivityBarPosition>(LayoutSettings.ACTIVITY_BAR_LOCATION));
384+
385+
if (activityBarMovedToTopOrBottom || editorActionsMovedToTitlebar || commandCenterEnabled || layoutControlsEnabled) {
368386
if (this.configurationService.getValue<CustomTitleBarVisibility>(TitleBarSetting.CUSTOM_TITLE_BAR_VISIBILITY) === CustomTitleBarVisibility.NEVER) {
369387
this.configurationService.updateValue(TitleBarSetting.CUSTOM_TITLE_BAR_VISIBILITY, CustomTitleBarVisibility.AUTO);
388+
return; // onDidChangeConfiguration will be triggered again
370389
}
371390
}
372391

0 commit comments

Comments
 (0)