diff --git a/assets/keymaps/default.json b/assets/keymaps/default.json index 1d95c33cbf..b11a790088 100644 --- a/assets/keymaps/default.json +++ b/assets/keymaps/default.json @@ -310,7 +310,7 @@ "cmd-shift-m": "diagnostics::Deploy", "cmd-shift-e": "project_panel::ToggleFocus", "cmd-alt-s": "workspace::SaveAll", - "shift-escape": "terminal::DeployModal" + "shift-escape": "workspace::ToggleDock" } }, // Bindings from Sublime Text diff --git a/crates/theme/src/theme.rs b/crates/theme/src/theme.rs index 9d90b44402..b4ddd8ed94 100644 --- a/crates/theme/src/theme.rs +++ b/crates/theme/src/theme.rs @@ -57,6 +57,7 @@ pub struct Workspace { pub notifications: Notifications, pub joining_project_avatar: ImageStyle, pub joining_project_message: ContainedText, + pub fullscreen_dock: ContainerStyle, } #[derive(Clone, Deserialize, Default)] diff --git a/crates/workspace/src/dock.rs b/crates/workspace/src/dock.rs index f1e8aa8539..7bc407e508 100644 --- a/crates/workspace/src/dock.rs +++ b/crates/workspace/src/dock.rs @@ -105,7 +105,7 @@ impl Dock { fn ensure_not_empty(workspace: &mut Workspace, cx: &mut ViewContext) { let pane = workspace.dock.pane.clone(); - if !pane.read(cx).items().next().is_none() { + if pane.read(cx).items().next().is_none() { let item_to_add = (workspace.dock.default_item_factory)(workspace, cx); Pane::add_item(workspace, &pane, item_to_add, true, true, None, cx); } @@ -130,8 +130,12 @@ impl Dock { workspace.dock.position = workspace.dock.position.toggle(); if workspace.dock.position.visible().is_some() { Self::ensure_not_empty(workspace, cx); + cx.focus(workspace.dock.pane.clone()); + } else { + cx.focus_self(); } cx.notify(); + workspace.status_bar().update(cx, |_, cx| cx.notify()); } fn move_dock( @@ -198,7 +202,9 @@ impl View for ToggleDockButton { .boxed() }) .with_cursor_style(CursorStyle::PointingHand) - .on_click(MouseButton::Left, |_, cx| cx.dispatch_action(ToggleDock)) + .on_click(MouseButton::Left, |_, cx| { + cx.dispatch_action(ToggleDock); + }) // TODO: Add tooltip .boxed() } diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs index fc95deca90..f8e95dcb33 100644 --- a/crates/workspace/src/pane.rs +++ b/crates/workspace/src/pane.rs @@ -1613,8 +1613,7 @@ mod tests { let fs = FakeFs::new(cx.background()); let project = Project::test(fs, None, cx).await; - let (_, workspace) = - cx.add_window(|cx| Workspace::new(project, crate::tests::default_item_factory, cx)); + let (_, workspace) = cx.add_window(|cx| Workspace::new(project, default_item_factory, cx)); let pane = workspace.read_with(cx, |workspace, _| workspace.active_pane().clone()); // 1. Add with a destination index @@ -1702,8 +1701,7 @@ mod tests { let fs = FakeFs::new(cx.background()); let project = Project::test(fs, None, cx).await; - let (_, workspace) = - cx.add_window(|cx| Workspace::new(project, crate::tests::default_item_factory, cx)); + let (_, workspace) = cx.add_window(|cx| Workspace::new(project, default_item_factory, cx)); let pane = workspace.read_with(cx, |workspace, _| workspace.active_pane().clone()); // 1. Add with a destination index @@ -1779,8 +1777,7 @@ mod tests { let fs = FakeFs::new(cx.background()); let project = Project::test(fs, None, cx).await; - let (_, workspace) = - cx.add_window(|cx| Workspace::new(project, crate::tests::default_item_factory, cx)); + let (_, workspace) = cx.add_window(|cx| Workspace::new(project, default_item_factory, cx)); let pane = workspace.read_with(cx, |workspace, _| workspace.active_pane().clone()); // singleton view diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index 56b771020d..a67910d694 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -2614,7 +2614,13 @@ impl View for Workspace { ) .boxed() }) - .with_children(self.dock.render(&theme, DockAnchor::Expanded)) + .with_children(self.dock.render(&theme, DockAnchor::Expanded).map( + |dock| { + Container::new(dock) + .with_style(theme.workspace.fullscreen_dock) + .boxed() + }, + )) .with_children(self.modal.as_ref().map(|m| { ChildView::new(m) .contained() diff --git a/styles/src/styleTree/workspace.ts b/styles/src/styleTree/workspace.ts index 875b2bb2d5..d47b76cd05 100644 --- a/styles/src/styleTree/workspace.ts +++ b/styles/src/styleTree/workspace.ts @@ -156,5 +156,9 @@ export default function workspace(theme: Theme) { width: 400, margin: { right: 10, bottom: 10 }, }, + fullscreenDock: { + background: withOpacity(theme.backgroundColor[500].base, 0.8), + padding: 25, + } }; }