mirror of
https://github.com/Eugeny/tabby.git
synced 2025-06-23 12:59:54 +00:00
custom shells (fixes #50)
This commit is contained in:
parent
0fe7edc5b5
commit
fb64ca08d3
@ -238,6 +238,14 @@
|
|||||||
[ngValue]='shell.id'
|
[ngValue]='shell.id'
|
||||||
) {{shell.name}}
|
) {{shell.name}}
|
||||||
|
|
||||||
|
.form-group(*ngIf='config.store.terminal.shell == "custom"')
|
||||||
|
label Custom shell
|
||||||
|
input.form-control(
|
||||||
|
type='text',
|
||||||
|
'[(ngModel)]'='config.store.terminal.customShell',
|
||||||
|
(ngModelChange)='config.save()',
|
||||||
|
)
|
||||||
|
|
||||||
.form-group
|
.form-group
|
||||||
label Terminal bell
|
label Terminal bell
|
||||||
br
|
br
|
||||||
|
@ -10,6 +10,7 @@ export class TerminalConfigProvider extends ConfigProvider {
|
|||||||
background: 'theme',
|
background: 'theme',
|
||||||
ligatures: false,
|
ligatures: false,
|
||||||
cursor: 'block',
|
cursor: 'block',
|
||||||
|
customShell: '',
|
||||||
colorScheme: {
|
colorScheme: {
|
||||||
__nonStructural: true,
|
__nonStructural: true,
|
||||||
name: 'Material',
|
name: 'Material',
|
||||||
|
@ -24,6 +24,7 @@ import { TerminalConfigProvider } from './config'
|
|||||||
import { TerminalHotkeyProvider } from './hotkeys'
|
import { TerminalHotkeyProvider } from './hotkeys'
|
||||||
import { HyperColorSchemes } from './colorSchemes'
|
import { HyperColorSchemes } from './colorSchemes'
|
||||||
|
|
||||||
|
import { CustomShellProvider } from './shells/custom'
|
||||||
import { Cygwin32ShellProvider } from './shells/cygwin32'
|
import { Cygwin32ShellProvider } from './shells/cygwin32'
|
||||||
import { Cygwin64ShellProvider } from './shells/cygwin64'
|
import { Cygwin64ShellProvider } from './shells/cygwin64'
|
||||||
import { GitBashShellProvider } from './shells/gitBash'
|
import { GitBashShellProvider } from './shells/gitBash'
|
||||||
@ -59,6 +60,7 @@ import { hterm } from './hterm'
|
|||||||
{ provide: ShellProvider, useClass: WindowsStockShellsProvider, multi: true },
|
{ provide: ShellProvider, useClass: WindowsStockShellsProvider, multi: true },
|
||||||
{ provide: ShellProvider, useClass: MacOSDefaultShellProvider, multi: true },
|
{ provide: ShellProvider, useClass: MacOSDefaultShellProvider, multi: true },
|
||||||
{ provide: ShellProvider, useClass: LinuxDefaultShellProvider, multi: true },
|
{ provide: ShellProvider, useClass: LinuxDefaultShellProvider, multi: true },
|
||||||
|
{ provide: ShellProvider, useClass: CustomShellProvider, multi: true },
|
||||||
{ provide: ShellProvider, useClass: Cygwin32ShellProvider, multi: true },
|
{ provide: ShellProvider, useClass: Cygwin32ShellProvider, multi: true },
|
||||||
{ provide: ShellProvider, useClass: Cygwin64ShellProvider, multi: true },
|
{ provide: ShellProvider, useClass: Cygwin64ShellProvider, multi: true },
|
||||||
{ provide: ShellProvider, useClass: GitBashShellProvider, multi: true },
|
{ provide: ShellProvider, useClass: GitBashShellProvider, multi: true },
|
||||||
|
@ -14,14 +14,22 @@ export class TerminalService {
|
|||||||
private app: AppService,
|
private app: AppService,
|
||||||
private sessions: SessionsService,
|
private sessions: SessionsService,
|
||||||
private config: ConfigService,
|
private config: ConfigService,
|
||||||
@Inject(ShellProvider) shellProviders: ShellProvider[],
|
@Inject(ShellProvider) private shellProviders: ShellProvider[],
|
||||||
log: LogService,
|
log: LogService,
|
||||||
) {
|
) {
|
||||||
this.logger = log.create('terminal')
|
this.logger = log.create('terminal')
|
||||||
Promise.all(shellProviders.map(x => x.provide())).then(shellLists => {
|
this.reloadShells()
|
||||||
|
|
||||||
|
config.changed$.subscribe(() => {
|
||||||
|
this.reloadShells()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
async reloadShells () {
|
||||||
|
this.shells$ = new AsyncSubject<IShell[]>()
|
||||||
|
let shellLists = await Promise.all(this.shellProviders.map(x => x.provide()))
|
||||||
this.shells$.next(shellLists.reduce((a, b) => a.concat(b)))
|
this.shells$.next(shellLists.reduce((a, b) => a.concat(b)))
|
||||||
this.shells$.complete()
|
this.shells$.complete()
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async openTab (shell?: IShell, cwd?: string): Promise<TerminalTabComponent> {
|
async openTab (shell?: IShell, cwd?: string): Promise<TerminalTabComponent> {
|
||||||
|
21
terminus-terminal/src/shells/custom.ts
Normal file
21
terminus-terminal/src/shells/custom.ts
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import { Injectable } from '@angular/core'
|
||||||
|
import { ConfigService } from 'terminus-core'
|
||||||
|
|
||||||
|
import { ShellProvider, IShell } from '../api'
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class CustomShellProvider extends ShellProvider {
|
||||||
|
constructor (
|
||||||
|
private config: ConfigService,
|
||||||
|
) {
|
||||||
|
super()
|
||||||
|
}
|
||||||
|
|
||||||
|
async provide (): Promise<IShell[]> {
|
||||||
|
return [{
|
||||||
|
id: 'custom',
|
||||||
|
name: 'Custom',
|
||||||
|
command: this.config.store.terminal.customShell
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user