Add process ID to terminal tab tooltips (#21955)

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>
This commit is contained in:
Angelk90 2025-01-09 18:52:06 +01:00 committed by GitHub
parent 9f9f3d215d
commit 35d3d29bcf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 65 additions and 4 deletions

View file

@ -0,0 +1,36 @@
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),
),
)
})
}
}