Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/paneEditor.component.pug
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
input.form-control(
type='text',
[(ngModel)]='pane.cwd',
placeholder='C:\\path\\to\\project'
placeholder='C:\\path\\to\\project or /home/user/project'
)

.form-group
Expand Down
18 changes: 14 additions & 4 deletions src/services/workspaceEditor.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,18 @@ export class WorkspaceEditorService {
}
}

const rawCwd = pane.cwd || baseProfile.options?.cwd || ''
const isWsl = this.isWslProfile(baseProfile)
const baseArgs = baseProfile.options?.args || []

// Build complete profile object like Tabby expects
const options = {
restoreFromPTYID: false,
command: baseProfile.options?.command || '',
args: baseProfile.options?.args || [],
cwd: pane.cwd || baseProfile.options?.cwd || '',
// WSL: inject --cd to set Linux CWD directly (bypasses fs.existsSync validation)
args: isWsl && rawCwd ? [...baseArgs, '--cd', rawCwd] : baseArgs,
// WSL: don't set cwd (Unix paths fail fs.existsSync on Windows)
cwd: isWsl ? '' : rawCwd,
env: baseProfile.options?.env || {},
width: null,
height: null,
Expand Down Expand Up @@ -247,7 +253,6 @@ export class WorkspaceEditorService {
// tabTitle: workspace name (what user sees)
// tabCustomTitle: pane.id (for matching in StartupCommandService)
// workspaceId: for duplicate detection after Tabby recovery
const cwd = pane.cwd || baseProfile.options?.cwd || ''
return {
type: 'app:local-tab',
profile,
Expand All @@ -256,7 +261,7 @@ export class WorkspaceEditorService {
tabCustomTitle: pane.id,
workspaceId,
disableDynamicTitle: true,
cwd,
cwd: isWsl ? '' : rawCwd,
}
}

Expand Down Expand Up @@ -289,6 +294,11 @@ export class WorkspaceEditorService {
|| 'workspace'
}

/** Detects WSL profiles by ID prefix (type is always 'local' for all built-in shells). */
private isWslProfile(profile: TabbyProfile): boolean {
return profile.id?.startsWith('local:wsl') ?? false
}

private getProfileById(profileId: string): TabbyProfile | undefined {
const isLocalType = (type: string) => type === 'local' || type?.startsWith('local:')

Expand Down
Loading