Skip to repository content74 lines · 2.4 KB · rust
tenant.openagents/omega
No repository description is available.
OpenAgents Git authority 2026-07-28T06:09:50.615Z Public web read
NIP-34 coordinate
30617:7649603503856e5148d571eac2766b288a8ff1e9e35d380337a1d2b0015b4f92:omegaMaintainersHidden in public view
References2 branches · 1 tag
Read-only clone
git clone https://openagents.com/git/tenant.openagents/omega.gitBrowse files
search_status_button.rs
1use editor::EditorSettings;
2use gpui::{App, FocusHandle};
3use settings::Settings as _;
4use ui::{ButtonCommon, Clickable, Context, Render, Tooltip, Window, prelude::*};
5use workspace::{HideStatusItem, ItemHandle, StatusItemView};
6
7pub const SEARCH_ICON: IconName = IconName::MagnifyingGlass;
8
9pub struct SearchButton {
10 pane_item_focus_handle: Option<FocusHandle>,
11}
12
13impl SearchButton {
14 pub fn new() -> Self {
15 Self {
16 pane_item_focus_handle: None,
17 }
18 }
19}
20
21impl Render for SearchButton {
22 fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl ui::IntoElement {
23 let button = div();
24
25 if !EditorSettings::get_global(cx).search.button {
26 return button.hidden();
27 }
28
29 let focus_handle = self.pane_item_focus_handle.clone();
30 button.child(
31 IconButton::new("project-search-indicator", SEARCH_ICON)
32 .icon_size(IconSize::Small)
33 .tab_index(0isize)
34 .aria_label("Project Search")
35 .tooltip(move |_window, cx| {
36 if let Some(focus_handle) = &focus_handle {
37 Tooltip::for_action_in(
38 "Project Search",
39 &workspace::DeploySearch::default(),
40 focus_handle,
41 cx,
42 )
43 } else {
44 Tooltip::for_action(
45 "Project Search",
46 &workspace::DeploySearch::default(),
47 cx,
48 )
49 }
50 })
51 .on_click(cx.listener(|_this, _, window, cx| {
52 window.dispatch_action(Box::new(workspace::DeploySearch::default()), cx);
53 })),
54 )
55 }
56}
57
58impl StatusItemView for SearchButton {
59 fn set_active_pane_item(
60 &mut self,
61 active_pane_item: Option<&dyn ItemHandle>,
62 _window: &mut Window,
63 cx: &mut Context<Self>,
64 ) {
65 self.pane_item_focus_handle = active_pane_item.map(|item| item.item_focus_handle(cx));
66 }
67
68 fn hide_setting(&self, _: &App) -> Option<HideStatusItem> {
69 Some(HideStatusItem::new(|settings| {
70 settings.editor.search.get_or_insert_default().button = Some(false);
71 }))
72 }
73}
74