allow specifying a custom startup directory (fixes #223)

This commit is contained in:
Eugene Pankov 2017-10-23 21:54:40 +02:00
parent 33f67503bd
commit 8d12d6a547
4 changed files with 54 additions and 36 deletions

View File

@ -247,6 +247,15 @@
(ngModelChange)='config.save()', (ngModelChange)='config.save()',
) )
.form-group
label Working directory
input.form-control(
type='text',
placeholder='Home directory',
'[(ngModel)]'='config.store.terminal.workingDirectory',
(ngModelChange)='config.save()',
)
.d-flex .d-flex
.form-group.mr-3 .form-group.mr-3
label Terminal bell label Terminal bell
@ -301,7 +310,8 @@
) )
| On | On
.form-group .d-flex
.form-group.mr-3(*ngIf='persistenceProviders.length > 0')
label Session persistence label Session persistence
select.form-control( select.form-control(
'[(ngModel)]'='config.store.terminal.persistence', '[(ngModel)]'='config.store.terminal.persistence',

View File

@ -13,6 +13,7 @@ export class TerminalConfigProvider extends ConfigProvider {
cursor: 'block', cursor: 'block',
cursorBlink: true, cursorBlink: true,
customShell: '', customShell: '',
workingDirectory: '',
colorScheme: { colorScheme: {
__nonStructural: true, __nonStructural: true,
name: 'Material', name: 'Material',

View File

@ -33,8 +33,12 @@ export class TerminalService {
} }
async openTab (shell?: IShell, cwd?: string): Promise<TerminalTabComponent> { async openTab (shell?: IShell, cwd?: string): Promise<TerminalTabComponent> {
if (!cwd && this.app.activeTab instanceof TerminalTabComponent) { if (!cwd) {
if (this.app.activeTab instanceof TerminalTabComponent) {
cwd = await this.app.activeTab.session.getWorkingDirectory() cwd = await this.app.activeTab.session.getWorkingDirectory()
} else {
cwd = this.config.store.terminal.workingDirectory || null
}
} }
if (!shell) { if (!shell) {
let shells = await this.shells$.toPromise() let shells = await this.shells$.toPromise()

View File

@ -25,7 +25,10 @@ export class WSLShellProvider extends ShellProvider {
return [{ return [{
id: 'wsl', id: 'wsl',
name: 'Bash on Windows', name: 'Bash on Windows',
command: wslPath command: wslPath,
env: {
TERM: 'xterm-color',
}
}] }]
} }
} }