diff --git a/crates/title_bar/src/title_bar.rs b/crates/title_bar/src/title_bar.rs index a2a1fb9ef3..225c3613ce 100644 --- a/crates/title_bar/src/title_bar.rs +++ b/crates/title_bar/src/title_bar.rs @@ -36,7 +36,7 @@ use ui::{ IconWithIndicator, Indicator, PopoverMenu, Tooltip, h_flex, prelude::*, }; use util::ResultExt; -use workspace::{BottomDockLayout, SetBottomDockLayout, Workspace, notifications::NotifyResultExt}; +use workspace::{BottomDockLayout, Workspace, notifications::NotifyResultExt}; use zed_actions::{OpenBrowser, OpenRecent, OpenRemote}; pub use onboarding_banner::restore_banner; @@ -635,89 +635,84 @@ impl TitleBar { ) .anchor(gpui::Corner::TopRight) .menu(move |window, cx| { - ContextMenu::build(window, cx, move |menu, _, _| { - menu.label("Bottom Dock") - .separator() - .toggleable_entry( - "Contained", - current_layout == BottomDockLayout::Contained, - ui::IconPosition::End, - Some( - SetBottomDockLayout { - layout: BottomDockLayout::Contained, - } - .boxed_clone(), - ), - |window, cx| { - window.dispatch_action( - SetBottomDockLayout { - layout: BottomDockLayout::Contained, + ContextMenu::build(window, cx, { + let workspace = workspace.clone(); + move |menu, _, _| { + menu.label("Bottom Dock") + .separator() + .toggleable_entry( + "Contained", + current_layout == BottomDockLayout::Contained, + ui::IconPosition::End, + None, + { + let workspace = workspace.clone(); + move |window, cx| { + workspace.update(cx, |workspace, cx| { + workspace.set_bottom_dock_layout( + BottomDockLayout::Contained, + window, + cx, + ); + }); } - .boxed_clone(), - cx, - ) - }, - ) - .toggleable_entry( - "Full", - current_layout == BottomDockLayout::Full, - ui::IconPosition::End, - Some( - SetBottomDockLayout { - layout: BottomDockLayout::Full, - } - .boxed_clone(), - ), - |window, cx| { - window.dispatch_action( - SetBottomDockLayout { - layout: BottomDockLayout::Full, + }, + ) + .toggleable_entry( + "Full", + current_layout == BottomDockLayout::Full, + ui::IconPosition::End, + None, + { + let workspace = workspace.clone(); + move |window, cx| { + workspace.update(cx, |workspace, cx| { + workspace.set_bottom_dock_layout( + BottomDockLayout::Full, + window, + cx, + ); + }); } - .boxed_clone(), - cx, - ) - }, - ) - .toggleable_entry( - "Left Aligned", - current_layout == BottomDockLayout::LeftAligned, - ui::IconPosition::End, - Some( - SetBottomDockLayout { - layout: BottomDockLayout::LeftAligned, - } - .boxed_clone(), - ), - |window, cx| { - window.dispatch_action( - SetBottomDockLayout { - layout: BottomDockLayout::LeftAligned, + }, + ) + .toggleable_entry( + "Left Aligned", + current_layout == BottomDockLayout::LeftAligned, + ui::IconPosition::End, + None, + { + let workspace = workspace.clone(); + move |window, cx| { + workspace.update(cx, |workspace, cx| { + workspace.set_bottom_dock_layout( + BottomDockLayout::LeftAligned, + window, + cx, + ); + }); } - .boxed_clone(), - cx, - ) - }, - ) - .toggleable_entry( - "Right Aligned", - current_layout == BottomDockLayout::RightAligned, - ui::IconPosition::End, - Some( - SetBottomDockLayout { - layout: BottomDockLayout::RightAligned, - } - .boxed_clone(), - ), - |window, cx| { - window.dispatch_action( - SetBottomDockLayout { - layout: BottomDockLayout::RightAligned, + }, + ) + .toggleable_entry( + "Right Aligned", + current_layout == BottomDockLayout::RightAligned, + ui::IconPosition::End, + None, + { + let workspace = workspace.clone(); + move |window, cx| { + workspace.update(cx, |workspace, cx| { + workspace.set_bottom_dock_layout( + BottomDockLayout::RightAligned, + window, + cx, + ); + }); } - .boxed_clone(), - cx, - ) - }, - ) + }, + ) + } }) .into() }) diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index bf498f2819..4ea8ecaed3 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -183,13 +183,6 @@ pub struct MoveItemToPane { pub focus: bool, } -#[derive(Clone, Deserialize, PartialEq, JsonSchema)] -#[serde(deny_unknown_fields)] -pub struct SetBottomDockLayout { - #[serde(default)] - pub layout: BottomDockLayout, -} - #[derive(Clone, Deserialize, PartialEq, JsonSchema)] #[serde(deny_unknown_fields)] pub struct MoveItemToPaneInDirection { @@ -254,7 +247,6 @@ impl_actions!( Save, SaveAll, SendKeystrokes, - SetBottomDockLayout ] ); @@ -5019,11 +5011,6 @@ impl Workspace { workspace.toggle_dock(DockPosition::Bottom, window, cx); }, )) - .on_action(cx.listener( - |workspace: &mut Workspace, action: &SetBottomDockLayout, window, cx| { - workspace.set_bottom_dock_layout(action.layout, window, cx); - }, - )) .on_action( cx.listener(|workspace: &mut Workspace, _: &CloseAllDocks, window, cx| { workspace.close_all_docks(window, cx);