From f8d106248477a0b2da020d7b938fa2d0442e13b1 Mon Sep 17 00:00:00 2001 From: Finn Evers Date: Wed, 30 Jul 2025 18:18:14 +0200 Subject: [PATCH] onboarding: Fix keybindings showing up after a delay (#35342) This fixes an issue where keybinds would only show up after a delay on the welcome page upon re-opening it. It also binds one of the buttons to the corresponding action. Release Notes: - N/A --- crates/onboarding/src/onboarding.rs | 2 +- crates/onboarding/src/welcome.rs | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/crates/onboarding/src/onboarding.rs b/crates/onboarding/src/onboarding.rs index cc0c47ca71a391198ae3711ae4027e7c2a714779..f1b29c205cec4c342168419c0d067e145b39672a 100644 --- a/crates/onboarding/src/onboarding.rs +++ b/crates/onboarding/src/onboarding.rs @@ -81,7 +81,7 @@ pub fn init(cx: &mut App) { if let Some(existing) = existing { workspace.activate_item(&existing, true, true, window, cx); } else { - let settings_page = WelcomePage::new(cx); + let settings_page = WelcomePage::new(window, cx); workspace.add_item_to_active_pane( Box::new(settings_page), None, diff --git a/crates/onboarding/src/welcome.rs b/crates/onboarding/src/welcome.rs index 2ea120e02187d3a6b556a32312512ae0f25d316f..9e524a5e8a7e234c6bdc9bbfcf6181821829091b 100644 --- a/crates/onboarding/src/welcome.rs +++ b/crates/onboarding/src/welcome.rs @@ -7,7 +7,7 @@ use workspace::{ NewFile, Open, Workspace, WorkspaceId, item::{Item, ItemEvent}, }; -use zed_actions::{Extensions, OpenSettings, command_palette}; +use zed_actions::{Extensions, OpenSettings, agent, command_palette}; actions!( zed, @@ -55,8 +55,7 @@ const CONTENT: (Section<4>, Section<3>) = ( SectionEntry { icon: IconName::ZedAssistant, title: "View AI Settings", - // TODO: use proper action - action: &NoAction, + action: &agent::OpenSettings, }, SectionEntry { icon: IconName::Blocks, @@ -228,12 +227,14 @@ impl Render for WelcomePage { } impl WelcomePage { - pub fn new(cx: &mut Context) -> Entity { - let this = cx.new(|cx| WelcomePage { - focus_handle: cx.focus_handle(), - }); + pub fn new(window: &mut Window, cx: &mut Context) -> Entity { + cx.new(|cx| { + let focus_handle = cx.focus_handle(); + cx.on_focus(&focus_handle, window, |_, _, cx| cx.notify()) + .detach(); - this + WelcomePage { focus_handle } + }) } }