fixed #4230 - option to limit or disable "recent profiles"

This commit is contained in:
Eugene Pankov 2021-07-24 10:35:24 +02:00
parent 1926eca929
commit 90149def0a
No known key found for this signature in database
GPG key ID: 5896FCBBDD1CF4F4
4 changed files with 23 additions and 5 deletions

View file

@ -36,10 +36,12 @@ export class ButtonProvider extends ToolbarButtonProvider {
await this.profilesService.openNewTabForProfile(profile)
let recentProfiles = this.config.store.recentProfiles
recentProfiles = recentProfiles.filter(x => x.group !== profile.group || x.name !== profile.name)
recentProfiles.unshift(profile)
if (recentProfiles.length > 5) {
recentProfiles.pop()
if (this.config.store.terminal.showRecentProfiles > 0) {
recentProfiles = recentProfiles.filter(x => x.group !== profile.group || x.name !== profile.name)
recentProfiles.unshift(profile)
recentProfiles = recentProfiles.slice(0, this.config.store.terminal.showRecentProfiles)
} else {
recentProfiles = []
}
this.config.store.recentProfiles = recentProfiles
this.config.save()

View file

@ -16,6 +16,7 @@ appearance:
vibrancyType: 'blur'
terminal:
showBuiltinProfiles: true
showRecentProfiles: 3
hotkeys:
profile:
__nonStructural: true

View file

@ -93,7 +93,8 @@ export class ProfilesService {
showProfileSelector (): Promise<PartialProfile<Profile>|null> {
return new Promise<PartialProfile<Profile>|null>(async (resolve, reject) => {
try {
const recentProfiles: PartialProfile<Profile>[] = this.config.store.recentProfiles
let recentProfiles: PartialProfile<Profile>[] = this.config.store.recentProfiles
recentProfiles = recentProfiles.slice(0, this.config.store.terminal.showRecentProfiles)
let options: SelectorOption<void>[] = recentProfiles.map(p => ({
...this.selectorOptionForProfile(p),

View file

@ -17,6 +17,19 @@ h3.mb-3 Profiles
[ngValue]='profile.id'
) {{profile.name}}
.form-line(*ngIf='config.store.profiles.length > 0')
.header
.title Show recent profiles in selector
.description Set to 0 to disable recent profiles
input.form-control(
type='number',
min='0',
step='1',
[(ngModel)]='config.store.terminal.showRecentProfiles',
(ngModelChange)='config.save()'
)
.form-line(*ngIf='config.store.profiles.length > 0')
.header
.title Show built-in profiles in selector
@ -27,6 +40,7 @@ h3.mb-3 Profiles
(ngModelChange)='config.save()'
)
.d-flex.mb-3.mt-4
.input-group
.input-group-prepend