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; 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: wsl --install
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.
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(crate) struct WindowsSetupWidget {
pub codex_home: PathBuf, pub codex_home: PathBuf,
@@ -47,7 +48,7 @@ impl WindowsSetupWidget {
Self { Self {
codex_home, codex_home,
selection: None, selection: None,
highlighted: WindowsSetupSelection::Continue, highlighted: WindowsSetupSelection::Install,
error: None, error: None,
exit_requested: false, exit_requested: false,
} }
@@ -83,11 +84,10 @@ impl WindowsSetupWidget {
impl WidgetRef for &WindowsSetupWidget { impl WidgetRef for &WindowsSetupWidget {
fn render_ref(&self, area: Rect, buf: &mut Buffer) { fn render_ref(&self, area: Rect, buf: &mut Buffer) {
let mut lines: Vec<Line> = vec![ let mut lines: Vec<Line> = vec![
Line::from(vec!["> ".into(), "Codex Windows Support".bold()]), Line::from(vec![
Line::from(""), "> ".into(),
Line::from( "For best performance, run Codex in Windows Subsystem for Linux (WSL2)".bold(),
" Codex support for Windows is in progress. Full support for Codex on Windows requires Windows Subsystem for Linux (WSL2).", ]),
),
Line::from(""), Line::from(""),
]; ];
@@ -102,13 +102,13 @@ impl WidgetRef for &WindowsSetupWidget {
lines.push(create_option( lines.push(create_option(
0, 0,
WindowsSetupSelection::Continue, WindowsSetupSelection::Install,
"Continue anyway", "Exit and install WSL2",
)); ));
lines.push(create_option( lines.push(create_option(
1, 1,
WindowsSetupSelection::Install, WindowsSetupSelection::Continue,
"Exit and install Windows Subsystem for Linux (WSL2)", "Continue anyway",
)); ));
lines.push("".into()); lines.push("".into());
@@ -133,16 +133,16 @@ impl KeyboardHandler for WindowsSetupWidget {
match key_event.code { match key_event.code {
KeyCode::Up | KeyCode::Char('k') => { KeyCode::Up | KeyCode::Char('k') => {
self.highlighted = WindowsSetupSelection::Continue;
}
KeyCode::Down | KeyCode::Char('j') => {
self.highlighted = WindowsSetupSelection::Install; self.highlighted = WindowsSetupSelection::Install;
} }
KeyCode::Char('1') => self.handle_continue(), KeyCode::Down | KeyCode::Char('j') => {
KeyCode::Char('2') => self.handle_install(), self.highlighted = WindowsSetupSelection::Continue;
}
KeyCode::Char('1') => self.handle_install(),
KeyCode::Char('2') => self.handle_continue(),
KeyCode::Enter => match self.highlighted { KeyCode::Enter => match self.highlighted {
WindowsSetupSelection::Continue => self.handle_continue(),
WindowsSetupSelection::Install => self.handle_install(), WindowsSetupSelection::Install => self.handle_install(),
WindowsSetupSelection::Continue => self.handle_continue(),
}, },
_ => {} _ => {}
} }