diff --git a/src/vs/platform/terminal/node/ptyService.ts b/src/vs/platform/terminal/node/ptyService.ts index 16c68b790de04..ce67eec9555c1 100644 --- a/src/vs/platform/terminal/node/ptyService.ts +++ b/src/vs/platform/terminal/node/ptyService.ts @@ -142,6 +142,9 @@ export class PtyService extends Disposable implements IPtyService { { ...state.shellLaunchConfig, cwd: state.processDetails.cwd, + color: state.processDetails.color, + icon: state.processDetails.icon, + name: state.processDetails.title, initialText: state.replayEvent.events[0].data + '\x1b[0m\n\n\r\x1b[1;48;5;252;38;5;234m ' + restoreMessage + ' \x1b[K\x1b[0m\n\r' }, state.processDetails.cwd, @@ -190,7 +193,7 @@ export class PtyService extends Disposable implements IPtyService { executableEnv, windowsEnableConpty }; - const persistentProcess = new PersistentTerminalProcess(id, process, workspaceId, workspaceName, shouldPersist, cols, rows, processLaunchOptions, unicodeVersion, this._reconnectConstants, this._logService, isReviving ? shellLaunchConfig.initialText : undefined, shellLaunchConfig.icon, shellLaunchConfig.color, shellLaunchConfig.fixedDimensions); + const persistentProcess = new PersistentTerminalProcess(id, process, workspaceId, workspaceName, shouldPersist, cols, rows, processLaunchOptions, unicodeVersion, this._reconnectConstants, this._logService, isReviving ? shellLaunchConfig.initialText : undefined, shellLaunchConfig.icon, shellLaunchConfig.color, shellLaunchConfig.name, shellLaunchConfig.fixedDimensions); process.onDidChangeProperty(property => this._onDidChangeProperty.fire({ id, property })); process.onProcessExit(event => { persistentProcess.dispose(); @@ -461,9 +464,13 @@ export class PersistentTerminalProcess extends Disposable { reviveBuffer: string | undefined, private _icon?: TerminalIcon, private _color?: string, + name?: string, fixedDimensions?: IFixedTerminalDimensions ) { super(); + if (name) { + this.setTitle(name, TitleEventSource.Api); + } this._logService.trace('persistentTerminalProcess#ctor', _persistentProcessId, arguments); this._wasRevived = reviveBuffer !== undefined; this._serializer = new XtermSerializer( diff --git a/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts b/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts index 6f5cc9defa00d..070dd8961d0f1 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts @@ -136,6 +136,8 @@ export class TerminalInstance extends Disposable implements ITerminalInstance { private _containerReadyBarrier: AutoOpenBarrier; private _attachBarrier: AutoOpenBarrier; + private _icon: TerminalIcon | undefined; + private _messageTitleDisposable: IDisposable | undefined; private _widgetManager: TerminalWidgetManager = this._instantiationService.createInstance(TerminalWidgetManager); @@ -315,6 +317,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance { this._fixedRows = _shellLaunchConfig.attachPersistentProcess?.fixedDimensions?.rows; this._fixedCols = _shellLaunchConfig.attachPersistentProcess?.fixedDimensions?.cols; + this._icon = _shellLaunchConfig.attachPersistentProcess?.icon || _shellLaunchConfig.icon; // the resource is already set when it's been moved from another window this._resource = resource || getTerminalUri(this._workspaceContextService.getWorkspace().id, this.instanceId, this.title); @@ -409,11 +412,10 @@ export class TerminalInstance extends Disposable implements ITerminalInstance { } private _getIcon(): TerminalIcon | undefined { - const icon = this._shellLaunchConfig.icon || this._shellLaunchConfig.attachPersistentProcess?.icon; - if (!icon) { - return this._processManager.processState >= ProcessState.Launching ? Codicon.terminal : undefined; + if (!this._icon) { + this._icon = this._processManager.processState >= ProcessState.Launching ? Codicon.terminal : undefined; } - return icon; + return this._icon; } private _getColor(): string | undefined { @@ -1832,7 +1834,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance { matchOnDescription: true }); if (result && result.description) { - this.shellLaunchConfig.icon = iconRegistry.get(result.description); + this._icon = iconRegistry.get(result.description); this._onIconChanged.fire(this); } }