mirror of
https://github.com/Eugeny/tabby.git
synced 2025-10-04 14:04:56 +00:00
.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
import { HotkeysService, ToolbarButtonProvider, IToolbarButton, AppService, HostAppService, Platform } from 'terminus-core'
|
||||
import { HotkeysService, ToolbarButtonProvider, IToolbarButton, AppService, ConfigService } from 'terminus-core'
|
||||
|
||||
import { SessionsService } from './services/sessions'
|
||||
import { TerminalTabComponent } from './components/terminalTab'
|
||||
@@ -10,7 +10,7 @@ export class ButtonProvider extends ToolbarButtonProvider {
|
||||
constructor (
|
||||
private app: AppService,
|
||||
private sessions: SessionsService,
|
||||
private hostApp: HostAppService,
|
||||
private config: ConfigService,
|
||||
hotkeys: HotkeysService,
|
||||
) {
|
||||
super()
|
||||
@@ -26,11 +26,7 @@ export class ButtonProvider extends ToolbarButtonProvider {
|
||||
if (this.app.activeTab instanceof TerminalTabComponent) {
|
||||
cwd = await this.app.activeTab.session.getWorkingDirectory()
|
||||
}
|
||||
let command = {
|
||||
[Platform.macOS]: 'zsh',
|
||||
[Platform.Linux]: 'zsh',
|
||||
[Platform.Windows]: 'cmd.exe',
|
||||
}[this.hostApp.platform]
|
||||
let command = this.config.store.terminal.shell
|
||||
this.app.openNewTab(
|
||||
TerminalTabComponent,
|
||||
{ session: await this.sessions.createNewSession({ command, cwd }) }
|
||||
|
@@ -194,6 +194,15 @@
|
||||
[value]='"colorScheme"'
|
||||
)
|
||||
| From the terminal colors
|
||||
|
||||
.form-group
|
||||
label Shell
|
||||
input.form-control(
|
||||
type='text',
|
||||
[ngbTypeahead]='shellAutocomplete',
|
||||
'[(ngModel)]'='config.store.terminal.shell',
|
||||
(ngModelChange)='config.save()',
|
||||
)
|
||||
|
||||
.form-group
|
||||
label Terminal bell
|
||||
|
@@ -2,13 +2,14 @@ import { Observable } from 'rxjs/Observable'
|
||||
import 'rxjs/add/operator/map'
|
||||
import 'rxjs/add/operator/debounceTime'
|
||||
import 'rxjs/add/operator/distinctUntilChanged'
|
||||
import * as fs from 'fs-promise'
|
||||
const fontManager = require('font-manager')
|
||||
const equal = require('deep-equal')
|
||||
const { exec } = require('child-process-promise')
|
||||
|
||||
import { Component, Inject } from '@angular/core'
|
||||
import { ConfigService, HostAppService, Platform } from 'terminus-core'
|
||||
import { TerminalColorSchemeProvider, ITerminalColorScheme } from '../api'
|
||||
const { exec } = require('child-process-promise')
|
||||
|
||||
|
||||
@Component({
|
||||
@@ -17,6 +18,7 @@ const { exec } = require('child-process-promise')
|
||||
})
|
||||
export class TerminalSettingsTabComponent {
|
||||
fonts: string[] = []
|
||||
shells: string[] = []
|
||||
colorSchemes: ITerminalColorScheme[] = []
|
||||
equalComparator = equal
|
||||
editingColorScheme: ITerminalColorScheme
|
||||
@@ -43,6 +45,11 @@ export class TerminalSettingsTabComponent {
|
||||
.map(x => x.split(',')[0].trim())
|
||||
this.fonts.sort()
|
||||
})
|
||||
|
||||
this.shells = (await fs.readFile('/etc/shells', 'utf-8'))
|
||||
.split('\n')
|
||||
.map(x => x.trim())
|
||||
.filter(x => x && !x.startsWith('#'))
|
||||
}
|
||||
this.colorSchemes = (await Promise.all(this.colorSchemeProviders.map(x => x.getSchemes()))).reduce((a, b) => a.concat(b))
|
||||
}
|
||||
@@ -55,6 +62,10 @@ export class TerminalSettingsTabComponent {
|
||||
.map(list => Array.from(new Set(list)))
|
||||
}
|
||||
|
||||
shellAutocomplete = (text$: Observable<string>) => {
|
||||
return text$.map(_ => ['auto'].concat(this.shells))
|
||||
}
|
||||
|
||||
editScheme (scheme: ITerminalColorScheme) {
|
||||
this.editingColorScheme = scheme
|
||||
this.schemeChanged = false
|
||||
|
@@ -9,7 +9,9 @@ export class TerminalConfigProvider extends ConfigProvider {
|
||||
bell: 'off',
|
||||
bracketedPaste: true,
|
||||
background: 'theme',
|
||||
shell: 'auto',
|
||||
colorScheme: {
|
||||
__nonStructural: true,
|
||||
foreground: null,
|
||||
background: null,
|
||||
cursor: null,
|
||||
|
Reference in New Issue
Block a user