diff --git a/terminus-terminal/src/buttonProvider.ts b/terminus-terminal/src/buttonProvider.ts index 68ab3ab9..71035e16 100644 --- a/terminus-terminal/src/buttonProvider.ts +++ b/terminus-terminal/src/buttonProvider.ts @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ import * as fs from 'mz/fs' import { Injectable } from '@angular/core' -import { ToolbarButtonProvider, ToolbarButton, ElectronService } from 'terminus-core' +import { ToolbarButtonProvider, ToolbarButton, ElectronService, ConfigService } from 'terminus-core' import { TerminalService } from './services/terminal.service' @@ -10,6 +10,7 @@ import { TerminalService } from './services/terminal.service' export class ButtonProvider extends ToolbarButtonProvider { constructor ( electron: ElectronService, + private config: ConfigService, private terminal: TerminalService, ) { super() @@ -41,7 +42,7 @@ export class ButtonProvider extends ToolbarButtonProvider { icon: require('./icons/profiles.svg'), title: 'New terminal with profile', submenu: async () => { - const profiles = await this.terminal.getProfiles() + const profiles = await this.terminal.getProfiles({ skipDefault: !this.config.store.terminal.showDefaultProfiles }) return profiles.map(profile => ({ icon: profile.icon, title: profile.name, diff --git a/terminus-terminal/src/components/shellSettingsTab.component.pug b/terminus-terminal/src/components/shellSettingsTab.component.pug index 4c60fe10..ab12d6e1 100644 --- a/terminus-terminal/src/components/shellSettingsTab.component.pug +++ b/terminus-terminal/src/components/shellSettingsTab.component.pug @@ -74,6 +74,16 @@ h3.mb-3 Shell environment-editor([(model)]='this.config.store.terminal.environment') +.form-line(*ngIf='config.store.terminal.profiles.length > 0') + .header + .title Show default profiles in the selector + .description If disabled, only custom profiles will show up in the profile selector + + toggle( + [(ngModel)]='config.store.terminal.showDefaultProfiles', + (ngModelChange)='config.save()' + ) + h3.mt-3 Saved Profiles .list-group.list-group-flush.mt-3.mb-3 diff --git a/terminus-terminal/src/components/shellSettingsTab.component.ts b/terminus-terminal/src/components/shellSettingsTab.component.ts index 83ccad01..605ee2f5 100644 --- a/terminus-terminal/src/components/shellSettingsTab.component.ts +++ b/terminus-terminal/src/components/shellSettingsTab.component.ts @@ -46,7 +46,7 @@ export class ShellSettingsTabComponent { } async reload (): Promise { - this.profiles = await this.terminalService.getProfiles(true) + this.profiles = await this.terminalService.getProfiles({ includeHidden: true }) } pickWorkingDirectory (): void { diff --git a/terminus-terminal/src/config.ts b/terminus-terminal/src/config.ts index eda11c5e..cbd8e2f4 100644 --- a/terminus-terminal/src/config.ts +++ b/terminus-terminal/src/config.ts @@ -64,6 +64,7 @@ export class TerminalConfigProvider extends ConfigProvider { useConPTY: true, recoverTabs: true, warnOnMultilinePaste: true, + showDefaultProfiles: true, }, } diff --git a/terminus-terminal/src/services/terminal.service.ts b/terminus-terminal/src/services/terminal.service.ts index 249eb965..130d24f4 100644 --- a/terminus-terminal/src/services/terminal.service.ts +++ b/terminus-terminal/src/services/terminal.service.ts @@ -34,11 +34,11 @@ export class TerminalService { }) } - async getProfiles (includeHidden?: boolean): Promise { + async getProfiles ({ includeHidden, skipDefault }: { includeHidden?: boolean, skipDefault?: boolean } = {}): Promise { const shells = await this.shells$.toPromise() return [ ...this.config.store.terminal.profiles, - ...shells.filter(x => includeHidden || !x.hidden).map(shell => ({ + ...skipDefault ? [] : shells.filter(x => includeHidden || !x.hidden).map(shell => ({ name: shell.name, icon: shell.icon, sessionOptions: this.optionsFromShell(shell), @@ -53,7 +53,7 @@ export class TerminalService { */ async openTab (profile?: Profile, cwd?: string|null, pause?: boolean): Promise { if (!profile) { - const profiles = await this.getProfiles(true) + const profiles = await this.getProfiles({ includeHidden: true }) profile = profiles.find(x => slugify(x.name).toLowerCase() === this.config.store.terminal.profile) || profiles[0] }