Add key bindings to toggle the project panel

- Use `cmd-1` to open the project panel and toggle focus between it and the workspace center.
- Use `cmd-shift-1` to open or close the project panel.
This commit is contained in:
Max Brunsfeld
2021-09-30 15:26:14 -07:00
parent 8dcd38c25a
commit 2b3e5945c6
3 changed files with 54 additions and 4 deletions
+5
View File
@@ -2900,6 +2900,11 @@ impl AnyViewHandle {
TypeId::of::<T>() == self.view_type
}
pub fn is_focused(&self, cx: &AppContext) -> bool {
cx.focused_view_id(self.window_id)
.map_or(false, |focused_id| focused_id == self.view_id)
}
pub fn downcast<T: View>(self) -> Option<ViewHandle<T>> {
if self.is::<T>() {
let result = Some(ViewHandle {