Closes #12807 | Before | After | |--------|--------| | <img width="1336" alt="Screenshot 2025-01-09 at 2 14 15 PM" src="https://github.com/user-attachments/assets/8396cf41-74eb-4b5c-89e3-287e4f2ddd1d" /> | <img width="1336" alt="Screenshot 2025-01-09 at 2 13 34 PM" src="https://github.com/user-attachments/assets/b39c51e8-fd2c-41fe-9493-396057bd71db" /> | Release Notes: - Added the process ID (PID) to terminal tab tooltips. --------- Co-authored-by: Marshall Bowers <elliott.codes@gmail.com> Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
37 lines
1.1 KiB
Rust
37 lines
1.1 KiB
Rust
use gpui::{IntoElement, Render, ViewContext};
|
|
use ui::{prelude::*, tooltip_container, Divider};
|
|
|
|
pub struct TerminalTooltip {
|
|
title: SharedString,
|
|
pid: u32,
|
|
}
|
|
|
|
impl TerminalTooltip {
|
|
pub fn new(title: impl Into<SharedString>, pid: u32) -> Self {
|
|
Self {
|
|
title: title.into(),
|
|
pid,
|
|
}
|
|
}
|
|
}
|
|
|
|
impl Render for TerminalTooltip {
|
|
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
|
|
tooltip_container(cx, move |this, _cx| {
|
|
this.occlude()
|
|
.on_mouse_move(|_, cx| cx.stop_propagation())
|
|
.child(
|
|
v_flex()
|
|
.gap_1()
|
|
.child(Label::new(self.title.clone()))
|
|
.child(Divider::horizontal())
|
|
.child(
|
|
Label::new(format!("Process ID (PID): {}", self.pid))
|
|
.color(Color::Muted)
|
|
.size(LabelSize::Small),
|
|
),
|
|
)
|
|
})
|
|
}
|
|
}
|