mirror of
https://github.com/Eugeny/tabby.git
synced 2025-07-20 10:28:05 +00:00
suggest WSL root path as working directory (#454)
This commit is contained in:
@@ -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
|
||||
|
@@ -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]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -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',
|
||||
|
Reference in New Issue
Block a user