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

@ -10,7 +10,7 @@ use windows::Win32::{Foundation::HANDLE, System::Threading::GetProcessId};
use sysinfo::{Pid, Process, ProcessRefreshKind, RefreshKind, System, UpdateKind};
struct ProcessIdGetter {
pub struct ProcessIdGetter {
handle: i32,
fallback_pid: u32,
}
@ -31,6 +31,10 @@ impl ProcessIdGetter {
}
Some(Pid::from_u32(pid as u32))
}
pub fn fallback_pid(&self) -> u32 {
self.fallback_pid
}
}
#[cfg(windows)]
@ -62,6 +66,10 @@ impl ProcessIdGetter {
}
Some(Pid::from_u32(pid))
}
pub fn fallback_pid(&self) -> u32 {
self.fallback_pid
}
}
#[derive(Clone, Debug)]
@ -96,6 +104,10 @@ impl PtyProcessInfo {
}
}
pub fn pid_getter(&self) -> &ProcessIdGetter {
&self.pid_getter
}
fn refresh(&mut self) -> Option<&Process> {
let pid = self.pid_getter.pid()?;
if self.system.refresh_processes_specifics(