mirror of
https://github.com/Eugeny/tabby.git
synced 2025-01-03 08:04:02 +03:00
option to hide default profiles - fixes #2078
This commit is contained in:
parent
78a74ffe1b
commit
4969c4e2fc
@ -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,
|
||||
|
@ -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
|
||||
|
@ -46,7 +46,7 @@ export class ShellSettingsTabComponent {
|
||||
}
|
||||
|
||||
async reload (): Promise<void> {
|
||||
this.profiles = await this.terminalService.getProfiles(true)
|
||||
this.profiles = await this.terminalService.getProfiles({ includeHidden: true })
|
||||
}
|
||||
|
||||
pickWorkingDirectory (): void {
|
||||
|
@ -64,6 +64,7 @@ export class TerminalConfigProvider extends ConfigProvider {
|
||||
useConPTY: true,
|
||||
recoverTabs: true,
|
||||
warnOnMultilinePaste: true,
|
||||
showDefaultProfiles: true,
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -34,11 +34,11 @@ export class TerminalService {
|
||||
})
|
||||
}
|
||||
|
||||
async getProfiles (includeHidden?: boolean): Promise<Profile[]> {
|
||||
async getProfiles ({ includeHidden, skipDefault }: { includeHidden?: boolean, skipDefault?: boolean } = {}): Promise<Profile[]> {
|
||||
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<TerminalTabComponent> {
|
||||
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]
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user