@@ -116,12 +116,18 @@ interface IInitialEditorsState {
116
116
readonly layout ?: EditorGroupLayout ;
117
117
}
118
118
119
+ const COMMAND_CENTER_SETTINGS = [
120
+ 'chat.commandCenter.enabled' ,
121
+ 'workbench.navigationControl.enabled' ,
122
+ 'workbench.experimental.share.enabled' ,
123
+ ] ;
124
+
119
125
export const TITLE_BAR_SETTINGS = [
120
126
LayoutSettings . ACTIVITY_BAR_LOCATION ,
121
127
LayoutSettings . COMMAND_CENTER ,
128
+ ...COMMAND_CENTER_SETTINGS ,
122
129
LayoutSettings . EDITOR_ACTIONS_LOCATION ,
123
130
LayoutSettings . LAYOUT_ACTIONS ,
124
- 'workbench.navigationControl.enabled' ,
125
131
'window.menuBarVisibility' ,
126
132
TitleBarSetting . TITLE_BAR_STYLE ,
127
133
TitleBarSetting . CUSTOM_TITLE_BAR_VISIBILITY ,
@@ -355,18 +361,31 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
355
361
LegacyWorkbenchLayoutSettings . SIDEBAR_POSITION ,
356
362
LegacyWorkbenchLayoutSettings . STATUSBAR_VISIBLE ,
357
363
] . 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
+ }
365
377
}
366
378
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 ) {
368
386
if ( this . configurationService . getValue < CustomTitleBarVisibility > ( TitleBarSetting . CUSTOM_TITLE_BAR_VISIBILITY ) === CustomTitleBarVisibility . NEVER ) {
369
387
this . configurationService . updateValue ( TitleBarSetting . CUSTOM_TITLE_BAR_VISIBILITY , CustomTitleBarVisibility . AUTO ) ;
388
+ return ; // onDidChangeConfiguration will be triggered again
370
389
}
371
390
}
372
391
0 commit comments