mirror of
https://github.com/Eugeny/tabby.git
synced 2025-09-24 00:56:06 +00:00
fixed hotkey IDs for profiles with "." in name - fixes #4367
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import { Injectable } from '@angular/core'
|
import { Injectable } from '@angular/core'
|
||||||
import { ProfilesService } from './services/profiles.service'
|
import { ProfilesService } from './services/profiles.service'
|
||||||
import { HotkeyDescription, HotkeyProvider } from './api/hotkeyProvider'
|
import { HotkeyDescription, HotkeyProvider } from './api/hotkeyProvider'
|
||||||
|
import { PartialProfile, Profile } from './api'
|
||||||
|
|
||||||
/** @hidden */
|
/** @hidden */
|
||||||
@Injectable()
|
@Injectable()
|
||||||
@@ -193,9 +194,13 @@ export class AppHotkeyProvider extends HotkeyProvider {
|
|||||||
return [
|
return [
|
||||||
...this.hotkeys,
|
...this.hotkeys,
|
||||||
...profiles.map(profile => ({
|
...profiles.map(profile => ({
|
||||||
id: `profile.${profile.id}`,
|
id: `profile.${AppHotkeyProvider.getProfileHotkeyName(profile)}`,
|
||||||
name: `New tab: ${profile.name}`,
|
name: `New tab: ${profile.name}`,
|
||||||
})),
|
})),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static getProfileHotkeyName (profile: PartialProfile<Profile>): string {
|
||||||
|
return profile.id!.replace(/\./g, '-')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -151,8 +151,9 @@ export default class AppModule { // eslint-disable-line @typescript-eslint/no-ex
|
|||||||
|
|
||||||
hotkeys.hotkey$.subscribe(async (hotkey) => {
|
hotkeys.hotkey$.subscribe(async (hotkey) => {
|
||||||
if (hotkey.startsWith('profile.')) {
|
if (hotkey.startsWith('profile.')) {
|
||||||
const id = hotkey.split('.')[1]
|
const id = hotkey.substring(hotkey.indexOf('.') + 1)
|
||||||
const profile = (await profilesService.getProfiles()).find(x => x.id === id)
|
const profiles = await profilesService.getProfiles()
|
||||||
|
const profile = profiles.find(x => AppHotkeyProvider.getProfileHotkeyName(x) === id)
|
||||||
if (profile) {
|
if (profile) {
|
||||||
profilesService.openNewTabForProfile(profile)
|
profilesService.openNewTabForProfile(profile)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user