From ac5019f4d97235ce470747bf4d001f5f3f69f7e4 Mon Sep 17 00:00:00 2001 From: Clem Date: Sat, 4 Feb 2023 11:05:14 +0100 Subject: [PATCH] fix Eugeny/tabby#4684 - removing profile's hotkeys on profile delete --- .../src/components/profilesSettingsTab.component.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tabby-settings/src/components/profilesSettingsTab.component.ts b/tabby-settings/src/components/profilesSettingsTab.component.ts index d425a653..05bc0c6b 100644 --- a/tabby-settings/src/components/profilesSettingsTab.component.ts +++ b/tabby-settings/src/components/profilesSettingsTab.component.ts @@ -4,7 +4,7 @@ import slugify from 'slugify' import deepClone from 'clone-deep' import { Component, Inject } from '@angular/core' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' -import { ConfigService, HostAppService, Profile, SelectorService, ProfilesService, PromptModalComponent, PlatformService, BaseComponent, PartialProfile, ProfileProvider, TranslateService, Platform } from 'tabby-core' +import { ConfigService, HostAppService, Profile, SelectorService, ProfilesService, PromptModalComponent, PlatformService, BaseComponent, PartialProfile, ProfileProvider, TranslateService, Platform, AppHotkeyProvider } from 'tabby-core' import { EditProfileModalComponent } from './editProfileModal.component' interface ProfileGroup { @@ -146,6 +146,13 @@ export class ProfilesSettingsTabComponent extends BaseComponent { this.profilesService.providerForProfile(profile)?.deleteProfile( this.profilesService.getConfigProxyForProfile(profile)) this.config.store.profiles = this.config.store.profiles.filter(x => x !== profile) + const profileHotkeyName = AppHotkeyProvider.getProfileHotkeyName(profile) + if (this.config.store.hotkeys.profile.hasOwnProperty(profileHotkeyName)) { + const profileHotkeys = deepClone(this.config.store.hotkeys.profile) + // eslint-disable-next-line @typescript-eslint/no-dynamic-delete + delete profileHotkeys[profileHotkeyName] + this.config.store.hotkeys.profile = profileHotkeys + } await this.config.save() } }