mirror of
https://github.com/Eugeny/tabby.git
synced 2025-07-20 02:18:01 +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
|
.form-line
|
||||||
.header
|
.header
|
||||||
.title Working directory
|
.title Working directory
|
||||||
input.form-control(
|
.input-group
|
||||||
type='text',
|
input.form-control(
|
||||||
placeholder='Home directory',
|
type='text',
|
||||||
[(ngModel)]='config.store.terminal.workingDirectory',
|
placeholder='Home directory',
|
||||||
(ngModelChange)='config.save()',
|
[(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 { Component, Inject } from '@angular/core'
|
||||||
import { ConfigService } from 'terminus-core'
|
import { ConfigService, ElectronService } from 'terminus-core'
|
||||||
import { IShell, ShellProvider, SessionPersistenceProvider } from '../api'
|
import { IShell, ShellProvider, SessionPersistenceProvider } from '../api'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -11,6 +11,7 @@ export class ShellSettingsTabComponent {
|
|||||||
|
|
||||||
constructor (
|
constructor (
|
||||||
public config: ConfigService,
|
public config: ConfigService,
|
||||||
|
private electron: ElectronService,
|
||||||
@Inject(ShellProvider) private shellProviders: ShellProvider[],
|
@Inject(ShellProvider) private shellProviders: ShellProvider[],
|
||||||
@Inject(SessionPersistenceProvider) persistenceProviders: SessionPersistenceProvider[],
|
@Inject(SessionPersistenceProvider) persistenceProviders: SessionPersistenceProvider[],
|
||||||
) {
|
) {
|
||||||
@@ -20,4 +21,16 @@ export class ShellSettingsTabComponent {
|
|||||||
async ngOnInit () {
|
async ngOnInit () {
|
||||||
this.shells = (await Promise.all(this.config.enabledServices(this.shellProviders).map(x => x.provide()))).reduce((a, b) => a.concat(b))
|
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}`,
|
name: `WSL / ${name}`,
|
||||||
command: wslPath,
|
command: wslPath,
|
||||||
args: ['-d', name],
|
args: ['-d', name],
|
||||||
fsBase: (child as any).$values.basepath,
|
fsBase: (child as any).$values.basepath + '\\rootfs',
|
||||||
env: {
|
env: {
|
||||||
TERM: 'xterm-color',
|
TERM: 'xterm-color',
|
||||||
COLORTERM: 'truecolor',
|
COLORTERM: 'truecolor',
|
||||||
|
Reference in New Issue
Block a user