# croft on Windows
Short version: **run croft inside WSL2, hosted in a graphics-capable terminal (WezTerm).**
- Native Windows (PowerShell / `conhost`) is not supported, and is unlikely to be worth supporting, for the reasons below.
- For what croft does and the full keyboard surface see the [README](../README.md) and [KEYBINDINGS.md](KEYBINDINGS.md).
## WSL2 works today (it is the Linux build)
croft has no separate "Windows" target. Inside WSL2 you are running real Linux.
- croft's normal `x86_64-unknown-linux-gnu` build compiles and runs **unmodified**.
- Full feature set: PTYs, file watching, language servers, the `Ctrl` command modifier, and `croft remote <host>`.
- Everything in [LINUX.md](LINUX.md) applies verbatim.
```bash
# inside your WSL2 distro (Ubuntu, Debian, etc.)
cargo install croft-software --locked
```
What WSL does **not** change is the terminal. A WSL shell renders into whichever Windows terminal emulator hosts it. That choice decides whether you get the full icon/image UI or the degraded text fallback:
| **WezTerm** (Windows build, pointed at the WSL shell) | Full UI: activity-bar icons, file icons, the hero image, and PDF / image / spreadsheet previews all render. **Recommended.** |
| **Windows Terminal** (the default WSL host) | Runs image-less: icons fall back to Nerd Font glyphs, image and PDF previews to half-block characters under a metadata-header line. |
| Legacy `conhost` console | Same image-less fallback, and a worse Nerd Font / truecolor story. |
- WezTerm implements the iTerm2 OSC-1337 and Kitty graphics protocols croft draws with.
- Under Windows Terminal, croft shows its one-time "switch terminal" nudge on launch.
The practical setup: WSL2 for the OS, WezTerm for the terminal, and a Nerd Font configured in WezTerm. See [LINUX.md](LINUX.md) for the font and dependency notes, which all apply inside WSL.
## Why native Windows (PowerShell / conhost) is not supported
Reading "Windows is not supported" as "nobody ported the PTY yet," gets it backwards: the PTY is the *least* of it. croft uses [`portable-pty`](https://crates.io/crates/portable-pty) (`Cargo.toml`), the WezTerm crate that already abstracts Windows ConPTY. Three other layers block a port, in increasing order of difficulty.
### 1. Direct POSIX syscalls (mechanical, but everywhere)
`libc` is a hard dependency, and croft calls it directly on several paths. None exist on Windows and none is behind a `cfg(windows)` branch, so the crate does not even compile for `*-pc-windows-msvc` today:
- `src/iterm2_inline.rs` — `libc::poll` / `pollfd` / `POLLIN` for the sixel DA1 capability probe (a timed raw read of stdin).
- `src/remote.rs` — `getrlimit` / `setrlimit` on `RLIMIT_NOFILE` to raise the open-file limit before spawning PTYs, watchers, LSPs, and the cross-link.
- `src/dap/transport.rs`, `src/lsp/install.rs` — `setsid` / `getsid` to detach spawned adapters and servers into their own process group.
- `src/widgets/file_tree.rs` — `localtime_r` for mtime formatting and the `EXDEV` cross-device-rename fallback.
Porting these is busywork, not research, but it touches many modules. Each needs a Win32 equivalent behind a `cfg(windows)` arm: `WaitForMultipleObjects` / overlapped I/O, `SetHandleInformation` or job objects, `CreateProcess` flags, `GetDiskFreeSpaceEx`, `localtime_s`.
### 2. macOS / Linux-only glue
Several integrations are written for the two supported OSes and silently no-op elsewhere:
- **Clipboard** (`src/clipboard.rs`): `NSPasteboard` on macOS, `wl-copy` / `xclip` / `xsel` on Linux. The `cfg(not(any(macos, linux)))` arm returns nothing, so copy/paste would be dead on native Windows until a Win32 clipboard backend is added.
- **Cmd-chord delivery, the drag-out helper, and the `setup-iterm2` / `setup-ghostty` commands** are macOS-and-iTerm2 specific, with no Windows analogue.
### 3. The graphics model is the real wall, and it is terminal-deep, not OS-deep
This is the decisive one.
- croft's visual identity is painted with the **iTerm2 OSC-1337** inline-image protocol and the **Kitty graphics protocol**, with sixel as a runtime-probed fallback.
- That covers activity-bar icons, file-type icons, the no-repo hero illustration, the editor/welcome background, and every PDF / image / spreadsheet preview.
- croft assumes a terminal speaking at least one of these.
- The stock Windows console stack (`conhost`, and the Windows Terminal that fronts PowerShell) implements **none** of them.
- So even with every syscall above ported and the binary running cleanly under PowerShell, you would get the image-less fallback: Nerd Font glyphs for icons, half-block characters for image previews. That is the degraded mode croft already warns about at startup, on any OS.
The real UI on Windows needs a terminal emulator implementing the protocols. In practice that means **WezTerm** (cross-platform, speaks both).
Once you run WezTerm on Windows, the natural way to give it a POSIX environment is WSL, which puts you back on the supported Linux build.
Hence "WSL2 + WezTerm" over a native port: the port's best case still needs WezTerm, and WSL gets there without rewriting the syscall and clipboard layers.
## Summary
- **Use croft on Windows via WSL2**, hosted in WezTerm, with a Nerd Font configured. This is fully supported as the Linux build.
- **Native PowerShell / conhost is not supported** and is not on the roadmap:
- It would need Windows branches for every `libc` call plus a Win32 clipboard backend.
- Even then the stock Windows console cannot render croft's graphics, so the payoff is capped at the image-less fallback unless you run WezTerm anyway.