From 957a9dc194c23b193fd1d613d61afcaa960dd730 Mon Sep 17 00:00:00 2001 From: Johannes Date: Tue, 24 May 2022 12:53:25 +0200 Subject: [PATCH] rename `titleMenu` to `commandCenter` This changes hows types and variables are called but also theme colors and the setting name are changing --- src/vs/platform/actions/common/actions.ts | 2 +- .../browser/actions/quickAccessActions.ts | 2 +- src/vs/workbench/browser/layout.ts | 2 +- .../parts/editor/editor.contribution.ts | 4 +- ...MenuControl.ts => commandCenterControl.ts} | 38 +++++++++---------- .../parts/titlebar/media/titlebarpart.css | 32 ++++++++-------- .../browser/parts/titlebar/titlebarPart.ts | 20 +++++----- .../browser/workbench.contribution.ts | 4 +- .../services/title/common/titleService.ts | 2 +- 9 files changed, 53 insertions(+), 53 deletions(-) rename src/vs/workbench/browser/parts/titlebar/{titleMenuControl.ts => commandCenterControl.ts} (87%) diff --git a/src/vs/platform/actions/common/actions.ts b/src/vs/platform/actions/common/actions.ts index beff01998fa..881043379fc 100644 --- a/src/vs/platform/actions/common/actions.ts +++ b/src/vs/platform/actions/common/actions.ts @@ -67,7 +67,7 @@ export class MenuId { static readonly ExplorerContext = new MenuId('ExplorerContext'); static readonly ExtensionContext = new MenuId('ExtensionContext'); static readonly GlobalActivity = new MenuId('GlobalActivity'); - static readonly TitleMenu = new MenuId('TitleMenu'); + static readonly CommandCenter = new MenuId('CommandCenter'); static readonly LayoutControlMenuSubmenu = new MenuId('LayoutControlMenuSubmenu'); static readonly LayoutControlMenu = new MenuId('LayoutControlMenu'); static readonly MenubarMainMenu = new MenuId('MenubarMainMenu'); diff --git a/src/vs/workbench/browser/actions/quickAccessActions.ts b/src/vs/workbench/browser/actions/quickAccessActions.ts index 8c08c8e8057..6cda33c142c 100644 --- a/src/vs/workbench/browser/actions/quickAccessActions.ts +++ b/src/vs/workbench/browser/actions/quickAccessActions.ts @@ -141,7 +141,7 @@ registerAction2(class QuickAccessAction extends Action2 { }, f1: true, menu: { - id: MenuId.TitleMenu, + id: MenuId.CommandCenter, order: 100 } }); diff --git a/src/vs/workbench/browser/layout.ts b/src/vs/workbench/browser/layout.ts index 2740f42fde9..10a0a5e03ec 100644 --- a/src/vs/workbench/browser/layout.ts +++ b/src/vs/workbench/browser/layout.ts @@ -148,7 +148,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi let quickPickTop = 0; if (this.isVisible(Parts.TITLEBAR_PART)) { top = this.getPart(Parts.TITLEBAR_PART).maximumHeight; - quickPickTop = this.titleService.titleMenuVisible ? 0 : top; + quickPickTop = this.titleService.isCommandCenterVisible ? 0 : top; } return { top, quickPickTop }; } diff --git a/src/vs/workbench/browser/parts/editor/editor.contribution.ts b/src/vs/workbench/browser/parts/editor/editor.contribution.ts index 1d6605352df..ef757abd139 100644 --- a/src/vs/workbench/browser/parts/editor/editor.contribution.ts +++ b/src/vs/workbench/browser/parts/editor/editor.contribution.ts @@ -314,8 +314,8 @@ if (isMacintosh) { }); } -MenuRegistry.appendMenuItem(MenuId.TitleMenu, { order: 1, command: { id: NavigateBackwardsAction.ID, title: NavigateBackwardsAction.LABEL, icon: Codicon.arrowLeft } }); -MenuRegistry.appendMenuItem(MenuId.TitleMenu, { order: 2, command: { id: NavigateForwardAction.ID, title: NavigateForwardAction.LABEL, icon: Codicon.arrowRight } }); +MenuRegistry.appendMenuItem(MenuId.CommandCenter, { order: 1, command: { id: NavigateBackwardsAction.ID, title: NavigateBackwardsAction.LABEL, icon: Codicon.arrowLeft } }); +MenuRegistry.appendMenuItem(MenuId.CommandCenter, { order: 2, command: { id: NavigateForwardAction.ID, title: NavigateForwardAction.LABEL, icon: Codicon.arrowRight } }); // Empty Editor Group Toolbar MenuRegistry.appendMenuItem(MenuId.EmptyEditorGroup, { command: { id: UNLOCK_GROUP_COMMAND_ID, title: localize('unlockGroupAction', "Unlock Group"), icon: Codicon.lock }, group: 'navigation', order: 10, when: ActiveEditorGroupLockedContext }); diff --git a/src/vs/workbench/browser/parts/titlebar/titleMenuControl.ts b/src/vs/workbench/browser/parts/titlebar/commandCenterControl.ts similarity index 87% rename from src/vs/workbench/browser/parts/titlebar/titleMenuControl.ts rename to src/vs/workbench/browser/parts/titlebar/commandCenterControl.ts index 63dd190ea82..c0728f1c334 100644 --- a/src/vs/workbench/browser/parts/titlebar/titleMenuControl.ts +++ b/src/vs/workbench/browser/parts/titlebar/commandCenterControl.ts @@ -27,7 +27,7 @@ import { WindowTitle } from 'vs/workbench/browser/parts/titlebar/windowTitle'; import { MENUBAR_SELECTION_BACKGROUND, MENUBAR_SELECTION_FOREGROUND, TITLE_BAR_ACTIVE_FOREGROUND } from 'vs/workbench/common/theme'; import { IHoverService } from 'vs/workbench/services/hover/browser/hover'; -export class TitleMenuControl { +export class CommandCenterControl { private readonly _disposables = new DisposableStore(); @@ -47,7 +47,7 @@ export class TitleMenuControl { @IConfigurationService configurationService: IConfigurationService, @IKeybindingService keybindingService: IKeybindingService, ) { - this.element.classList.add('title-menu'); + this.element.classList.add('command-center'); const hoverDelegate = new class implements IHoverDelegate { @@ -134,16 +134,16 @@ export class TitleMenuControl { return createActionViewItem(instantiationService, action, { hoverDelegate }); } }); - const titleMenu = this._disposables.add(menuService.createMenu(MenuId.TitleMenu, contextKeyService)); - const titleMenuDisposables = this._disposables.add(new DisposableStore()); - const updateTitleMenu = () => { - titleMenuDisposables.clear(); + const menu = this._disposables.add(menuService.createMenu(MenuId.CommandCenter, contextKeyService)); + const menuDisposables = this._disposables.add(new DisposableStore()); + const menuUpdater = () => { + menuDisposables.clear(); const actions: IAction[] = []; - titleMenuDisposables.add(createAndFillInContextMenuActions(titleMenu, undefined, actions)); + menuDisposables.add(createAndFillInContextMenuActions(menu, undefined, actions)); titleToolbar.setActions(actions); }; - updateTitleMenu(); - this._disposables.add(titleMenu.onDidChange(updateTitleMenu)); + menuUpdater(); + this._disposables.add(menu.onDidChange(menuUpdater)); this._disposables.add(quickInputService.onShow(this._setVisibility.bind(this, false))); this._disposables.add(quickInputService.onHide(this._setVisibility.bind(this, true))); } @@ -162,34 +162,34 @@ export class TitleMenuControl { // foreground (inactive and active) colors.registerColor( - 'titleMenu.foreground', + 'commandCenter.foreground', { dark: TITLE_BAR_ACTIVE_FOREGROUND, hcDark: TITLE_BAR_ACTIVE_FOREGROUND, light: TITLE_BAR_ACTIVE_FOREGROUND, hcLight: TITLE_BAR_ACTIVE_FOREGROUND }, - localize('titleMenu-foreground', "Foreground color of the title menu"), + localize('commandCenter-foreground', "Foreground color of the command center"), false ); colors.registerColor( - 'titleMenu.activeForeground', + 'commandCenter.activeForeground', { dark: MENUBAR_SELECTION_FOREGROUND, hcDark: MENUBAR_SELECTION_FOREGROUND, light: MENUBAR_SELECTION_FOREGROUND, hcLight: MENUBAR_SELECTION_FOREGROUND }, - localize('titleMenu-activeForeground', "Active foreground color of the title menu"), + localize('commandCenter-activeForeground', "Active foreground color of the command center"), false ); // background (inactive and active) colors.registerColor( - 'titleMenu.background', + 'commandCenter.background', { dark: null, hcDark: null, light: null, hcLight: null }, - localize('titleMenu-background', "Background color of the title menu"), + localize('commandCenter-background', "Background color of the command center"), false ); const activeBackground = colors.registerColor( - 'titleMenu.activeBackground', + 'commandCenter.activeBackground', { dark: MENUBAR_SELECTION_BACKGROUND, hcDark: MENUBAR_SELECTION_BACKGROUND, light: MENUBAR_SELECTION_BACKGROUND, hcLight: MENUBAR_SELECTION_BACKGROUND }, - localize('titleMenu-activeBackground', "Active background color of the title menu"), + localize('commandCenter-activeBackground', "Active background color of the command center"), false ); // border: defaults to active background colors.registerColor( - 'titleMenu.border', + 'commandCenter.border', { dark: activeBackground, hcDark: colors.inputBorder, light: activeBackground, hcLight: colors.inputBorder }, - localize('titleMenu-border', "Border color of the title menu"), + localize('commandCenter-border', "Border color of the command center"), false ); diff --git a/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css b/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css index 1a1d9490d5c..77abc653614 100644 --- a/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css +++ b/src/vs/workbench/browser/parts/titlebar/media/titlebarpart.css @@ -80,21 +80,21 @@ } /* Window Title Menu */ -.monaco-workbench .part.titlebar>.titlebar-container>.window-title>.title-menu { +.monaco-workbench .part.titlebar>.titlebar-container>.window-title>.command-center { z-index: 2550; -webkit-app-region: no-drag; padding: 0 8px; } -.monaco-workbench .part.titlebar>.titlebar-container>.window-title>.title-menu.hide { +.monaco-workbench .part.titlebar>.titlebar-container>.window-title>.command-center.hide { display: none; } -.monaco-workbench .part.titlebar>.titlebar-container>.window-title>.title-menu .action-item.quickopen { +.monaco-workbench .part.titlebar>.titlebar-container>.window-title>.command-center .action-item.quickopen { display: flex; - color: var(--vscode-titleMenu-foreground); - background-color: var(--vscode-titleMenu-background); - border: 1px solid var(--vscode-titleMenu-border); + color: var(--vscode-commandCenter-foreground); + background-color: var(--vscode-commandCenter-background); + border: 1px solid var(--vscode-commandCenter-border); border-radius: 5px; height: 20px; line-height: 18px; @@ -106,18 +106,18 @@ overflow: hidden; } -.monaco-workbench .part.titlebar>.titlebar-container>.window-title>.title-menu .action-item.quickopen:HOVER { - color: var(--vscode-titleMenu-activeForeground); - background-color: var(--vscode-titleMenu-activeBackground); +.monaco-workbench .part.titlebar>.titlebar-container>.window-title>.command-center .action-item.quickopen:HOVER { + color: var(--vscode-commandCenter-activeForeground); + background-color: var(--vscode-commandCenter-activeBackground); line-height: 18px; } -.monaco-workbench .part.titlebar>.titlebar-container>.window-title>.title-menu:HOVER .quickopen .action-label { +.monaco-workbench .part.titlebar>.titlebar-container>.window-title>.command-center:HOVER .quickopen .action-label { background-color: transparent !important; outline-color: transparent !important; } -.monaco-workbench .part.titlebar>.titlebar-container>.window-title>.title-menu .action-item.quickopen>.action-label.search { +.monaco-workbench .part.titlebar>.titlebar-container>.window-title>.command-center .action-item.quickopen>.action-label.search { display: inline-flex; text-align: center; font-size: 12px; @@ -127,18 +127,18 @@ width: calc(100% - 19px); } -.monaco-workbench .part.titlebar>.titlebar-container>.window-title>.title-menu .action-item.quickopen>.action-label.search>.search-icon { +.monaco-workbench .part.titlebar>.titlebar-container>.window-title>.command-center .action-item.quickopen>.action-label.search>.search-icon { font-size: 14px; opacity: .8; padding: 0 3px; } -.monaco-workbench .part.titlebar>.titlebar-container>.window-title>.title-menu .action-item.quickopen>.action-label.search>.search-label { +.monaco-workbench .part.titlebar>.titlebar-container>.window-title>.command-center .action-item.quickopen>.action-label.search>.search-label { overflow: hidden; text-overflow: ellipsis; } -.monaco-workbench .part.titlebar>.titlebar-container>.window-title>.title-menu .action-item.quickopen>.all-options>.action-label { +.monaco-workbench .part.titlebar>.titlebar-container>.window-title>.command-center .action-item.quickopen>.all-options>.action-label { text-align: center; font-size: 12px; width: 16px; @@ -147,8 +147,8 @@ padding-right: 0; } -.monaco-workbench .part.titlebar>.titlebar-container>.window-title>.title-menu:HOVER .action-item.quickopen>.all-options>.action-label { - border-color: var(--vscode-titleMenu-border); +.monaco-workbench .part.titlebar>.titlebar-container>.window-title>.command-center:HOVER .action-item.quickopen>.all-options>.action-label { + border-color: var(--vscode-commandCenter-border); } /* Menubar */ diff --git a/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts b/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts index e35c289cb8e..e549362ba2d 100644 --- a/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts +++ b/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts @@ -33,11 +33,11 @@ import { Codicon } from 'vs/base/common/codicons'; import { getIconRegistry } from 'vs/platform/theme/common/iconRegistry'; import { ToolBar } from 'vs/base/browser/ui/toolbar/toolbar'; import { WindowTitle } from 'vs/workbench/browser/parts/titlebar/windowTitle'; -import { TitleMenuControl } from 'vs/workbench/browser/parts/titlebar/titleMenuControl'; +import { CommandCenterControl } from 'vs/workbench/browser/parts/titlebar/commandCenterControl'; export class TitlebarPart extends Part implements ITitleService { - private static readonly configTitleMenu = 'window.experimental.titleMenu'; + private static readonly configCommandCenter = 'window.experimental.commandCenter'; declare readonly _serviceBrand: undefined; @@ -102,8 +102,8 @@ export class TitlebarPart extends Part implements ITitleService { this.windowTitle.updateProperties(properties); } - get titleMenuVisible() { - return this.configurationService.getValue(TitlebarPart.configTitleMenu); + get isCommandCenterVisible() { + return this.configurationService.getValue(TitlebarPart.configCommandCenter); } private registerListeners(): void { @@ -137,7 +137,7 @@ export class TitlebarPart extends Part implements ITitleService { this.layoutControls.classList.toggle('show-layout-control', this.layoutControlEnabled); } - if (event.affectsConfiguration(TitlebarPart.configTitleMenu)) { + if (event.affectsConfiguration(TitlebarPart.configCommandCenter)) { this.updateTitle(); this.adjustTitleMarginToCenter(); this._onDidChangeTitleMenuVisibility.fire(); @@ -183,7 +183,7 @@ export class TitlebarPart extends Part implements ITitleService { private updateTitle(): void { this.titleDisposables.clear(); - if (!this.titleMenuVisible) { + if (!this.isCommandCenterVisible) { // Text Title this.title.innerText = this.windowTitle.value; this.titleDisposables.add(this.windowTitle.onDidChange(() => { @@ -192,10 +192,10 @@ export class TitlebarPart extends Part implements ITitleService { })); } else { // Menu Title - const titleMenu = this.instantiationService.createInstance(TitleMenuControl, this.windowTitle); - reset(this.title, titleMenu.element); - this.titleDisposables.add(titleMenu); - this.titleDisposables.add(titleMenu.onDidChangeVisibility(this.adjustTitleMarginToCenter, this)); + const commandCenter = this.instantiationService.createInstance(CommandCenterControl, this.windowTitle); + reset(this.title, commandCenter.element); + this.titleDisposables.add(commandCenter); + this.titleDisposables.add(commandCenter.onDidChangeVisibility(this.adjustTitleMarginToCenter, this)); } } diff --git a/src/vs/workbench/browser/workbench.contribution.ts b/src/vs/workbench/browser/workbench.contribution.ts index a0adbe40cb2..1e654bb15a1 100644 --- a/src/vs/workbench/browser/workbench.contribution.ts +++ b/src/vs/workbench/browser/workbench.contribution.ts @@ -538,10 +538,10 @@ const registry = Registry.as(ConfigurationExtensions.Con 'default': isMacintosh ? ' \u2014 ' : ' - ', 'markdownDescription': localize("window.titleSeparator", "Separator used by `window.title`.") }, - 'window.experimental.titleMenu': { + 'window.experimental.commandCenter': { type: 'boolean', default: false, - description: localize('window.experimental.titleMenu', "Show window title as menu") + description: localize('window.experimental.commandCenter', "Show command launcher together with the window title.") }, 'window.menuBarVisibility': { 'type': 'string', diff --git a/src/vs/workbench/services/title/common/titleService.ts b/src/vs/workbench/services/title/common/titleService.ts index a89bb2f096a..92aca9f92cd 100644 --- a/src/vs/workbench/services/title/common/titleService.ts +++ b/src/vs/workbench/services/title/common/titleService.ts @@ -26,7 +26,7 @@ export interface ITitleService { /** * Title menu is visible */ - readonly titleMenuVisible: boolean; + readonly isCommandCenterVisible: boolean; /** * An event when the title menu is enabled/disabled