diff --git a/src-tauri/src/pty.rs b/src-tauri/src/pty.rs index fb45a9f..094d847 100644 --- a/src-tauri/src/pty.rs +++ b/src-tauri/src/pty.rs @@ -67,10 +67,13 @@ impl PtyManager { cmd.arg("-d"); cmd.arg(d); } - if let Some(c) = cwd.as_deref() { - cmd.arg("--cd"); - cmd.arg(c); - } + // Default new panes to the WSL user's home (~) rather than the + // Windows-side cwd we inherit from the launcher (typically + // C:\Users\, which shows up as /mnt/c/Users/ inside WSL). + // wsl.exe resolves `~` against the distro's default shell. + let resolved_cwd = cwd.as_deref().unwrap_or("~"); + cmd.arg("--cd"); + cmd.arg(resolved_cwd); // Force a login shell so .bashrc etc. run and PATH is populated. // wsl.exe without an explicit command launches the default shell // interactively, which is exactly what we want.