Add terminal::Toggle (#37585)

Co-Authored-By: Brandan <b5@n0.computer>

Release Notes:

- Added a new action `terminal::Toggle` that is by default bound to
'ctrl-\`'. This copies the default behaviour from VSCode and Jetbrains
where the terminal opens and closes correctly. If you'd like the old
behaviour you can rebind 'ctrl-\`' to `terminal::ToggleFocus`

Co-authored-by: Brandan <b5@n0.computer>
This commit is contained in:
Conrad Irwin
2025-09-05 17:34:39 +00:00
committed by GitHub
co-authored by Brandan
parent b65fb06264
commit 5d374193bb
8 changed files with 26 additions and 7 deletions
+10
View File
@@ -3093,6 +3093,16 @@ impl Workspace {
}
}
pub fn close_panel<T: Panel>(&self, window: &mut Window, cx: &mut Context<Self>) {
for dock in self.all_docks().iter() {
dock.update(cx, |dock, cx| {
if dock.panel::<T>().is_some() {
dock.set_open(false, window, cx)
}
})
}
}
pub fn panel<T: Panel>(&self, cx: &App) -> Option<Entity<T>> {
self.all_docks()
.iter()