1use gpui::{IntoElement, Render};
2use ui::{Divider, prelude::*, tooltip_container};
3
4pub struct TerminalTooltip {
5 title: SharedString,
6 pid: u32,
7}
8
9impl TerminalTooltip {
10 pub fn new(title: impl Into<SharedString>, pid: u32) -> Self {
11 Self {
12 title: title.into(),
13 pid,
14 }
15 }
16}
17
18impl Render for TerminalTooltip {
19 fn render(&mut self, _: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
20 tooltip_container(cx, move |this, _cx| {
21 this.occlude()
22 .on_mouse_move(|_, _window, cx| cx.stop_propagation())
23 .child(
24 v_flex()
25 .gap_1()
26 .child(Label::new(self.title.clone()))
27 .child(Divider::horizontal())
28 .child(
29 Label::new(format!("Process ID (PID): {}", self.pid))
30 .color(Color::Muted)
31 .size(LabelSize::Small),
32 ),
33 )
34 })
35 }
36}