Skip to content

feat: add psmux session backend for windows#117

Open
matej21 wants to merge 1 commit intomainfrom
feat/psmux-windows-sessions
Open

feat: add psmux session backend for windows#117
matej21 wants to merge 1 commit intomainfrom
feat/psmux-windows-sessions

Conversation

@matej21
Copy link
Copy Markdown
Member

@matej21 matej21 commented May 4, 2026

Summary

  • Adds psmux as a Windows session backend, mirroring Unix dtach/tmux/screen integration. When psmux is on PATH, okena auto-detects it and wraps non-WSL shells through psmux new-session -A, so PowerShell/cmd sessions survive okena restart.
  • WSL terminals continue to use their own per-distro backend inside the distro (psmux is host-Windows only). Selecting Psmux for a WSL terminal falls back to dtach/tmux/screen inside WSL.
  • Same UX as Unix: install psmux (winget install psmux / cargo install psmux / scoop install psmux), okena handles the rest. No manual attach.

Implementation notes

  • SessionBackend::Psmux + ResolvedBackend::Psmux variants; Auto resolution prefers psmux on Windows, dtach > tmux > screen on Unix (unchanged).
  • is_psmux_available() runs psmux -V via crate::process::command (CREATE_NO_WINDOW).
  • build_command for Psmux: bypasses host shell (cmd.exe doesn't honor sh-style quoting); ; is psmux's literal command separator when received as its own argv token.
  • kill_session: psmux kill-session -t <name>.
  • Windows pty_manager::build_terminal_command now wraps non-WSL shells via host backend through a wrap_with_host_backend closure.

Known limitations (documented in code)

  • okena's default_shell setting isn't propagated into psmux sessions — psmux uses its own default-shell from ~/.psmux.conf (PowerShell out of the box). Custom command override via cmd.exe /c works.

Test plan

  • All 80 okena-terminal tests pass on Linux host
  • All 163 okena-workspace tests pass
  • okena-terminal cross-checks cleanly for x86_64-pc-windows-gnu
  • Added 5 new tests: build_command minimal/custom/extra_env, socket_path returns None, supports_persistence
  • Verified non-exhaustive matches in WSL paths (resolve_for_wsl, build_wsl_session_command, kill_wsl_session) handle the new variant correctly
  • Manual test on Windows: install psmux, launch okena, open PowerShell terminal, verify session persists across okena restart
  • Manual test on Windows: WSL terminal continues to use per-distro backend (no regression)

🤖 Generated with Claude Code

Mirrors the Unix dtach/tmux/screen integration for Windows: when psmux is
installed and on PATH, okena auto-detects it and wraps non-WSL shells
through `psmux new-session -A`, so PowerShell/cmd sessions survive okena
restart and reconnect transparently. WSL terminals continue to use their
own per-distro backend inside the distro.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant