From 6709217a8636573eb84d323eadec16ddfaa6ea51 Mon Sep 17 00:00:00 2001 From: Clem Date: Fri, 7 Jul 2023 15:03:57 +0200 Subject: [PATCH] fix(tabby-terminal): save icon/color/group/dynamic title/behavior on session end with 'Save As' Profile --- tabby-terminal/src/tabContextMenu.ts | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/tabby-terminal/src/tabContextMenu.ts b/tabby-terminal/src/tabContextMenu.ts index 349ea91a..2d96bdf5 100644 --- a/tabby-terminal/src/tabContextMenu.ts +++ b/tabby-terminal/src/tabContextMenu.ts @@ -1,6 +1,6 @@ import { Injectable, Optional, Inject } from '@angular/core' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' -import { BaseTabComponent, TabContextMenuItemProvider, NotificationsService, MenuItemOptions, TranslateService, SplitTabComponent, PromptModalComponent, ConfigService, PartialProfile, Profile } from 'tabby-core' +import { BaseTabComponent, TabContextMenuItemProvider, NotificationsService, MenuItemOptions, TranslateService, SplitTabComponent, PromptModalComponent, ConfigService, PartialProfile, Profile} from 'tabby-core' import { BaseTerminalTabComponent } from './api/baseTerminalTab.component' import { TerminalContextMenuItemProvider } from './api/contextMenuProvider' import { MultifocusService } from './services/multifocus.service' @@ -174,27 +174,33 @@ export class SaveAsProfileContextMenu extends TabContextMenuItemProvider { click: async () => { const modal = this.ngbModal.open(PromptModalComponent) modal.componentInstance.prompt = this.translate.instant('New profile name') + modal.componentInstance.value = tab.profile.name const name = (await modal.result)?.value if (!name) { return } - let options = {...tab.profile.options} + let options = { + ...tab.profile.options + } + const cwd = await tab.session?.getWorkingDirectory() ?? tab.profile.options.cwd if (cwd) { - options = { - ...options, - cwd - } + options.cwd = cwd } const profile: PartialProfile = { - options, - name, type: tab.profile.type, + name, + options } - profile.id = `${profile.type}:custom:${slugify(profile.name)}:${uuidv4()}` + profile.id = `${profile.type}:custom:${slugify(name)}:${uuidv4()}` + profile.group = tab.profile.group + profile.icon = tab.profile.icon + profile.color = tab.profile.color + profile.disableDynamicTitle = tab.profile.disableDynamicTitle + profile.behaviorOnSessionEnd = tab.profile.behaviorOnSessionEnd this.config.store.profiles = [ ...this.config.store.profiles,