Change:
Currently, allows several variables. It would be awesome for extensibility, if would be supported, with being an arbitrary context variable. Then extensions could contribute to the window title (candidates would be or ). I'd be up to create a PR! Related:
Sounds interesting, feel free to give it a try. The variables are substituted from here:
anyone assign me pls
Verification steps: an extension, create a contxt key and register a title variable to in settings and add the newly created title variable (for example ) sure the window title correctly renders the value of the variable in the command center / window title area

Discussion:
import { Color } from 'vs/base/common/color'; import { EventType, EventHelper, Dimension, append, $, addDisposableListener, prepend, reset, getWindow, getWindowId, isAncestor, getActiveDocument, isHTMLElement } from 'vs/base/browser/dom'; import { CustomMenubarControl } from 'vs/workbench/browser/parts/titlebar/menubarControl'; <del> import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; </del> <ins> import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; </ins> import { Emitter, Event } from 'vs/base/common/event'; import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; import { Parts, IWorkbenchLayoutService, ActivityBarPosition, LayoutSettings, EditorActionsLocation, EditorTabsMode } from 'vs/workbench/services/layout/browser/layoutService';

import { createInstantHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegateFactory'; import { IBaseActionViewItemOptions } from 'vs/base/browser/ui/actionbar/actionViewItems'; import { IHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegate'; <ins> import { CommandsRegistry } from 'vs/platform/commands/common/commands'; </ins> export interface ITitleVariable { readonly name: string;

this._register(this.registerPart(this.mainPart)); this.registerActions(); <ins> this.registerAPICommands(); </ins> } protected createMainTitlebarPart(): BrowserTitlebarPart {

})); } <ins> private registerAPICommands(): void { this._register(CommandsRegistry.registerCommand({ id: 'registerWindowTitleVariable', handler: (accessor: ServicesAccessor, name: string, contextKey: string) => { this.registerVariables([{ name, contextKey }]); }, metadata: { description: 'Registers a new title variable', args: [ { name: 'name', schema: { type: 'string' }, description: 'The name of the variable to register' }, { name: 'contextKey', schema: { type: 'string' }, description: 'The context key to use for the value of the variable' } ] } })); } </ins> //#region Auxiliary Titlebar Parts createAuxiliaryTitlebarPart(container: HTMLElement, editorGroupsContainer: IEditorGroupsContainer): IAuxiliaryTitlebarPart {

titlebarPart.updateProperties(this.properties); } <del> if (this.variables.length) { titlebarPart.registerVariables(this.variables); </del> <ins> if (this.variables.size) { titlebarPart.registerVariables(Array.from(this.variables.values())); </ins> } Event.once(titlebarPart.onWillDispose)(() => disposables.dispose());

} } <del> private variables: ITitleVariable[] = []; </del> <ins> private readonly variables = new Map<string, ITitleVariable>(); </ins> registerVariables(variables: ITitleVariable[]): void { <del> this.variables.push(...variables); </del> <ins> const newVariables: ITitleVariable[] = []; for (const variable of variables) { if (!this.variables.has(variable.name)) { this.variables.set(variable.name, variable); newVariables.push(variable); } } </ins> for (const part of this.parts) { <del> part.registerVariables(variables); </del> <ins> part.registerVariables(newVariables); </ins> } }