Dock menu

This commit is contained in:
Conrad Irwin 2023-11-17 12:14:06 -07:00
parent 9d742b90c3
commit eb04160d2d
3 changed files with 44 additions and 13 deletions

View file

@ -32,7 +32,7 @@ use workspace::{
notifications::NotifyResultExt,
register_deserializable_item,
searchable::{SearchEvent, SearchOptions, SearchableItem},
ui::{ContextMenu, Label},
ui::{ContextMenu, Label, ListEntry},
CloseActiveItem, NewCenterTerminal, Pane, ToolbarItemLocation, Workspace, WorkspaceId,
};
@ -85,7 +85,7 @@ pub struct TerminalView {
has_new_content: bool,
//Currently using iTerm bell, show bell emoji in tab until input is received
has_bell: bool,
context_menu: Option<View<ContextMenu>>,
context_menu: Option<View<ContextMenu<Self>>>,
blink_state: bool,
blinking_on: bool,
blinking_paused: bool,
@ -300,11 +300,10 @@ impl TerminalView {
position: gpui::Point<Pixels>,
cx: &mut ViewContext<Self>,
) {
self.context_menu = Some(cx.build_view(|cx| {
ContextMenu::new(cx)
.entry(Label::new("Clear"), Box::new(Clear))
.entry(
Label::new("Close"),
self.context_menu = Some(ContextMenu::build(cx, |menu, _| {
menu.action(ListEntry::new(Label::new("Clear")), Box::new(Clear))
.action(
ListEntry::new(Label::new("Close")),
Box::new(CloseActiveItem { save_intent: None }),
)
}));