feat: tweak windows wsl copy (#4795)

Tweaked the WSL dialogue and the installation instructions.
This commit is contained in:
ae
2025-10-05 19:44:26 -07:00
committed by GitHub
parent 8cd882c4bd
commit c264ae6021

View File

@@ -19,14 +19,15 @@ use crate::onboarding::onboarding_screen::StepStateProvider;
use super::onboarding_screen::StepState;
pub(crate) const WSL_INSTRUCTIONS: &str = r"Windows Subsystem for Linux (WSL2) is required to run Codex.
pub(crate) const WSL_INSTRUCTIONS: &str = r"Install WSL2 by opening PowerShell as Administrator and running:
To install WSL2:
1. Open PowerShell as Administrator and run: wsl --install
2. Restart your machine if prompted.
3. Launch the Ubuntu shortcut from the Start menu to complete setup.
wsl --install
After installation, reopen Codex from a WSL shell.";
After installation, run Codex from inside of WSL2 with:
wsl -e codex
More info: https://developers.openai.com/codex/windows";
pub(crate) struct WindowsSetupWidget {
pub codex_home: PathBuf,
@@ -47,7 +48,7 @@ impl WindowsSetupWidget {
Self {
codex_home,
selection: None,
highlighted: WindowsSetupSelection::Continue,
highlighted: WindowsSetupSelection::Install,
error: None,
exit_requested: false,
}
@@ -83,11 +84,10 @@ impl WindowsSetupWidget {
impl WidgetRef for &WindowsSetupWidget {
fn render_ref(&self, area: Rect, buf: &mut Buffer) {
let mut lines: Vec<Line> = vec![
Line::from(vec!["> ".into(), "Codex Windows Support".bold()]),
Line::from(""),
Line::from(
" Codex support for Windows is in progress. Full support for Codex on Windows requires Windows Subsystem for Linux (WSL2).",
),
Line::from(vec![
"> ".into(),
"For best performance, run Codex in Windows Subsystem for Linux (WSL2)".bold(),
]),
Line::from(""),
];
@@ -102,13 +102,13 @@ impl WidgetRef for &WindowsSetupWidget {
lines.push(create_option(
0,
WindowsSetupSelection::Continue,
"Continue anyway",
WindowsSetupSelection::Install,
"Exit and install WSL2",
));
lines.push(create_option(
1,
WindowsSetupSelection::Install,
"Exit and install Windows Subsystem for Linux (WSL2)",
WindowsSetupSelection::Continue,
"Continue anyway",
));
lines.push("".into());
@@ -133,16 +133,16 @@ impl KeyboardHandler for WindowsSetupWidget {
match key_event.code {
KeyCode::Up | KeyCode::Char('k') => {
self.highlighted = WindowsSetupSelection::Continue;
}
KeyCode::Down | KeyCode::Char('j') => {
self.highlighted = WindowsSetupSelection::Install;
}
KeyCode::Char('1') => self.handle_continue(),
KeyCode::Char('2') => self.handle_install(),
KeyCode::Down | KeyCode::Char('j') => {
self.highlighted = WindowsSetupSelection::Continue;
}
KeyCode::Char('1') => self.handle_install(),
KeyCode::Char('2') => self.handle_continue(),
KeyCode::Enter => match self.highlighted {
WindowsSetupSelection::Continue => self.handle_continue(),
WindowsSetupSelection::Install => self.handle_install(),
WindowsSetupSelection::Continue => self.handle_continue(),
},
_ => {}
}