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:
parent
9f9f3d215d
commit
35d3d29bcf
3 changed files with 65 additions and 4 deletions
|
@ -1,6 +1,7 @@
|
|||
mod persistence;
|
||||
pub mod terminal_element;
|
||||
pub mod terminal_panel;
|
||||
pub mod terminal_tab_tooltip;
|
||||
|
||||
use collections::HashSet;
|
||||
use editor::{actions::SelectAll, scroll::Autoscroll, Editor};
|
||||
|
@ -26,13 +27,16 @@ use terminal::{
|
|||
};
|
||||
use terminal_element::{is_blank, TerminalElement};
|
||||
use terminal_panel::TerminalPanel;
|
||||
use terminal_tab_tooltip::TerminalTooltip;
|
||||
use ui::{h_flex, prelude::*, ContextMenu, Icon, IconName, Label, Tooltip};
|
||||
use util::{
|
||||
paths::{PathWithPosition, SanitizedPath},
|
||||
ResultExt,
|
||||
};
|
||||
use workspace::{
|
||||
item::{BreadcrumbText, Item, ItemEvent, SerializableItem, TabContentParams},
|
||||
item::{
|
||||
BreadcrumbText, Item, ItemEvent, SerializableItem, TabContentParams, TabTooltipContent,
|
||||
},
|
||||
register_serializable_item,
|
||||
searchable::{SearchEvent, SearchOptions, SearchableItem, SearchableItemHandle},
|
||||
CloseActiveItem, NewCenterTerminal, NewTerminal, OpenVisible, ToolbarItemLocation, Workspace,
|
||||
|
@ -996,8 +1000,17 @@ impl Render for TerminalView {
|
|||
impl Item for TerminalView {
|
||||
type Event = ItemEvent;
|
||||
|
||||
fn tab_tooltip_text(&self, cx: &AppContext) -> Option<SharedString> {
|
||||
Some(self.terminal().read(cx).title(false).into())
|
||||
fn tab_tooltip_content(&self, cx: &AppContext) -> Option<TabTooltipContent> {
|
||||
let terminal = self.terminal().read(cx);
|
||||
let title = terminal.title(false);
|
||||
let pid = terminal.pty_info.pid_getter().fallback_pid();
|
||||
|
||||
Some(TabTooltipContent::Custom(Box::new(
|
||||
move |cx: &mut WindowContext| {
|
||||
cx.new_view(|_| TerminalTooltip::new(title.clone(), pid))
|
||||
.into()
|
||||
},
|
||||
)))
|
||||
}
|
||||
|
||||
fn tab_content(&self, params: TabContentParams, cx: &WindowContext) -> AnyElement {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue