mirror of
https://github.com/Eugeny/tabby.git
synced 2025-09-24 09:06:03 +00:00
option to hide default profiles - fixes #2078
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||||
import * as fs from 'mz/fs'
|
import * as fs from 'mz/fs'
|
||||||
import { Injectable } from '@angular/core'
|
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'
|
import { TerminalService } from './services/terminal.service'
|
||||||
|
|
||||||
@@ -10,6 +10,7 @@ import { TerminalService } from './services/terminal.service'
|
|||||||
export class ButtonProvider extends ToolbarButtonProvider {
|
export class ButtonProvider extends ToolbarButtonProvider {
|
||||||
constructor (
|
constructor (
|
||||||
electron: ElectronService,
|
electron: ElectronService,
|
||||||
|
private config: ConfigService,
|
||||||
private terminal: TerminalService,
|
private terminal: TerminalService,
|
||||||
) {
|
) {
|
||||||
super()
|
super()
|
||||||
@@ -41,7 +42,7 @@ export class ButtonProvider extends ToolbarButtonProvider {
|
|||||||
icon: require('./icons/profiles.svg'),
|
icon: require('./icons/profiles.svg'),
|
||||||
title: 'New terminal with profile',
|
title: 'New terminal with profile',
|
||||||
submenu: async () => {
|
submenu: async () => {
|
||||||
const profiles = await this.terminal.getProfiles()
|
const profiles = await this.terminal.getProfiles({ skipDefault: !this.config.store.terminal.showDefaultProfiles })
|
||||||
return profiles.map(profile => ({
|
return profiles.map(profile => ({
|
||||||
icon: profile.icon,
|
icon: profile.icon,
|
||||||
title: profile.name,
|
title: profile.name,
|
||||||
|
@@ -74,6 +74,16 @@ h3.mb-3 Shell
|
|||||||
|
|
||||||
environment-editor([(model)]='this.config.store.terminal.environment')
|
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
|
h3.mt-3 Saved Profiles
|
||||||
|
|
||||||
.list-group.list-group-flush.mt-3.mb-3
|
.list-group.list-group-flush.mt-3.mb-3
|
||||||
|
@@ -46,7 +46,7 @@ export class ShellSettingsTabComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async reload (): Promise<void> {
|
async reload (): Promise<void> {
|
||||||
this.profiles = await this.terminalService.getProfiles(true)
|
this.profiles = await this.terminalService.getProfiles({ includeHidden: true })
|
||||||
}
|
}
|
||||||
|
|
||||||
pickWorkingDirectory (): void {
|
pickWorkingDirectory (): void {
|
||||||
|
@@ -64,6 +64,7 @@ export class TerminalConfigProvider extends ConfigProvider {
|
|||||||
useConPTY: true,
|
useConPTY: true,
|
||||||
recoverTabs: true,
|
recoverTabs: true,
|
||||||
warnOnMultilinePaste: 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()
|
const shells = await this.shells$.toPromise()
|
||||||
return [
|
return [
|
||||||
...this.config.store.terminal.profiles,
|
...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,
|
name: shell.name,
|
||||||
icon: shell.icon,
|
icon: shell.icon,
|
||||||
sessionOptions: this.optionsFromShell(shell),
|
sessionOptions: this.optionsFromShell(shell),
|
||||||
@@ -53,7 +53,7 @@ export class TerminalService {
|
|||||||
*/
|
*/
|
||||||
async openTab (profile?: Profile, cwd?: string|null, pause?: boolean): Promise<TerminalTabComponent> {
|
async openTab (profile?: Profile, cwd?: string|null, pause?: boolean): Promise<TerminalTabComponent> {
|
||||||
if (!profile) {
|
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]
|
profile = profiles.find(x => slugify(x.name).toLowerCase() === this.config.store.terminal.profile) || profiles[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user