diff --git a/terminus-terminal/src/components/shellSettingsTab.component.pug b/terminus-terminal/src/components/shellSettingsTab.component.pug index 1de2b77d..be8f9fb8 100644 --- a/terminus-terminal/src/components/shellSettingsTab.component.pug +++ b/terminus-terminal/src/components/shellSettingsTab.component.pug @@ -41,9 +41,13 @@ h3.mb-3 Shell .form-line .header .title Working directory - input.form-control( - type='text', - placeholder='Home directory', - [(ngModel)]='config.store.terminal.workingDirectory', - (ngModelChange)='config.save()', - ) + .input-group + input.form-control( + type='text', + placeholder='Home directory', + [(ngModel)]='config.store.terminal.workingDirectory', + (ngModelChange)='config.save()', + ) + .input-group-btn + button.btn.btn-secondary((click)='pickWorkingDirectory()') + i.fa.fa-folder-open diff --git a/terminus-terminal/src/components/shellSettingsTab.component.ts b/terminus-terminal/src/components/shellSettingsTab.component.ts index 1116aea6..107777fa 100644 --- a/terminus-terminal/src/components/shellSettingsTab.component.ts +++ b/terminus-terminal/src/components/shellSettingsTab.component.ts @@ -1,5 +1,5 @@ import { Component, Inject } from '@angular/core' -import { ConfigService } from 'terminus-core' +import { ConfigService, ElectronService } from 'terminus-core' import { IShell, ShellProvider, SessionPersistenceProvider } from '../api' @Component({ @@ -11,6 +11,7 @@ export class ShellSettingsTabComponent { constructor ( public config: ConfigService, + private electron: ElectronService, @Inject(ShellProvider) private shellProviders: ShellProvider[], @Inject(SessionPersistenceProvider) persistenceProviders: SessionPersistenceProvider[], ) { @@ -20,4 +21,16 @@ export class ShellSettingsTabComponent { async ngOnInit () { this.shells = (await Promise.all(this.config.enabledServices(this.shellProviders).map(x => x.provide()))).reduce((a, b) => a.concat(b)) } + + pickWorkingDirectory () { + let shell = this.shells.find(x => x.id === this.config.store.terminal.shell) + console.log(shell) + let paths = this.electron.dialog.showOpenDialog({ + defaultPath: shell.fsBase, + properties: ['openDirectory', 'showHiddenFiles'], + }) + if (paths) { + this.config.store.terminal.workingDirectory = paths[0] + } + } } diff --git a/terminus-terminal/src/shells/wsl.ts b/terminus-terminal/src/shells/wsl.ts index cabfbe87..c3c2ee2d 100644 --- a/terminus-terminal/src/shells/wsl.ts +++ b/terminus-terminal/src/shells/wsl.ts @@ -57,7 +57,7 @@ export class WSLShellProvider extends ShellProvider { name: `WSL / ${name}`, command: wslPath, args: ['-d', name], - fsBase: (child as any).$values.basepath, + fsBase: (child as any).$values.basepath + '\\rootfs', env: { TERM: 'xterm-color', COLORTERM: 'truecolor',