From 057079886d19fcd8fc0a47d91565940c3acdab12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Sat, 9 May 2026 18:40:02 -0400 Subject: [PATCH] Brand glyphs in command overlay tab + history rows Open tabs and History results in the command switcher now lead with the brand glyph for their host (Notion, GitHub, Figma, Linear, etc.) instead of a generic Globe / Undo2. The action rows still use IconName glyphs because they map to internal navigation, not external sites. Internal: split row rendering into render_row_inner so both the icon and glyph variants share the same hover/click body. --- .../src/shell/chrome/command_overlay.rs | 83 +++++++++++++------ 1 file changed, 59 insertions(+), 24 deletions(-) diff --git a/crates/ely_app/src/shell/chrome/command_overlay.rs b/crates/ely_app/src/shell/chrome/command_overlay.rs index a5090b8..0693fa1 100644 --- a/crates/ely_app/src/shell/chrome/command_overlay.rs +++ b/crates/ely_app/src/shell/chrome/command_overlay.rs @@ -8,6 +8,7 @@ use gpui::{ use gpui_component::IconName; use crate::shell::ElyShell; +use crate::shell::chrome::render_glyph_for; const COMMAND_PREFIX: &str = ">"; const RESULT_LIMIT: usize = 4; @@ -166,17 +167,18 @@ fn render_tab_rows(tabs: Vec<&BrowserTab>, cx: &mut Context) -> AnyEle .children(tabs.into_iter().enumerate().map(|(index, tab)| { let tab_id = tab.id().clone(); let title = tab.title().to_string(); - let host = tab - .url() - .host() - .map(|host| host.to_string()) + let host = tab.url().host().map(|host| host.to_string()); + let host_label = host + .clone() .unwrap_or_else(|| tab.display_url()); + let initial = title.chars().next().unwrap_or('?').to_string(); - render_row( + render_row_with_glyph( format!("cmd-tab-{index}"), - IconName::Globe, + host.as_deref(), + &initial, title, - Some(host), + Some(host_label), None, cx, move |shell, window, cx| { @@ -198,15 +200,16 @@ fn render_history_rows( .children(entries.into_iter().enumerate().map(|(index, entry)| { let url = entry.url().clone(); let title = entry.title().to_string(); - let display = entry - .url() - .host() - .map(|host| host.to_string()) + let host = entry.url().host().map(|host| host.to_string()); + let display = host + .clone() .unwrap_or_else(|| entry.url().as_str().to_string()); + let initial = title.chars().next().unwrap_or('?').to_string(); - render_row( + render_row_with_glyph( format!("cmd-history-{index}"), - IconName::Undo2, + host.as_deref(), + &initial, title, Some(display), None, @@ -311,6 +314,48 @@ fn render_row( cx: &mut Context, handler: F, ) -> AnyElement +where + F: Fn(&mut ElyShell, &mut gpui::Window, &mut Context) + 'static, +{ + let leading = div() + .size(px(24.0)) + .rounded(px(6.0)) + .bg(rgba(ROW_ICON_BG)) + .flex() + .items_center() + .justify_center() + .text_color(rgb(colors::INK_2)) + .child(icon) + .into_any_element(); + render_row_inner(id, leading, title, hint, keys, cx, handler) +} + +fn render_row_with_glyph( + id: String, + host: Option<&str>, + fallback_initial: &str, + title: String, + hint: Option, + keys: Option, + cx: &mut Context, + handler: F, +) -> AnyElement +where + F: Fn(&mut ElyShell, &mut gpui::Window, &mut Context) + 'static, +{ + let leading = render_glyph_for(host, fallback_initial, 24.0); + render_row_inner(id, leading, title, hint, keys, cx, handler) +} + +fn render_row_inner( + id: String, + leading: AnyElement, + title: String, + hint: Option, + keys: Option, + cx: &mut Context, + handler: F, +) -> AnyElement where F: Fn(&mut ElyShell, &mut gpui::Window, &mut Context) + 'static, { @@ -325,17 +370,7 @@ where .hover(|style| style.bg(rgba(ROW_HOVER_BG))) .active(|style| style.opacity(0.85)) .on_click(cx.listener(move |shell, _, window, cx| handler(shell, window, cx))) - .child( - div() - .size(px(24.0)) - .rounded(px(6.0)) - .bg(rgba(ROW_ICON_BG)) - .flex() - .items_center() - .justify_center() - .text_color(rgb(colors::INK_2)) - .child(icon), - ) + .child(leading) .child( div() .flex_1()