diff --git a/crates/agent_ui/src/agent_panel.rs b/crates/agent_ui/src/agent_panel.rs index 73bde350fa12301d33d92ca5c787a74da2ebcaa3..ae7ab9d2cfb679aab6722f87eea30bf82de6d8e1 100644 --- a/crates/agent_ui/src/agent_panel.rs +++ b/crates/agent_ui/src/agent_panel.rs @@ -3206,7 +3206,7 @@ impl Panel for AgentPanel { } fn activation_priority(&self) -> u32 { - 3 + 8 } fn enabled(&self, cx: &App) -> bool { diff --git a/crates/agent_ui/src/agent_ui.rs b/crates/agent_ui/src/agent_ui.rs index db3b2526e45a4aade6d03a8d8ff87fd26106b76d..8f41944723e05e5a89d5df6ccc947c0d62488ff0 100644 --- a/crates/agent_ui/src/agent_ui.rs +++ b/crates/agent_ui/src/agent_ui.rs @@ -47,7 +47,7 @@ use client::Client; use command_palette_hooks::CommandPaletteFilter; use feature_flags::{AgentV2FeatureFlag, FeatureFlagAppExt as _}; use fs::Fs; -use gpui::{Action, App, Context, Entity, SharedString, Window, actions}; +use gpui::{Action, App, Context, Entity, SharedString, UpdateGlobal, Window, actions}; use language::{ LanguageRegistry, language_settings::{AllLanguageSettings, EditPredictionProvider}, @@ -59,7 +59,7 @@ use project::{AgentId, DisableAiSettings}; use prompt_store::PromptBuilder; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use settings::{LanguageModelSelection, Settings as _, SettingsStore}; +use settings::{DockPosition, DockSide, LanguageModelSelection, Settings as _, SettingsStore}; use std::any::TypeId; use workspace::Workspace; @@ -415,6 +415,31 @@ pub fn init( update_command_palette_filter(cx); }) .detach(); + + cx.observe_flag::(|is_enabled, cx| { + SettingsStore::update_global(cx, |store, cx| { + store.update_default_settings(cx, |defaults| { + if is_enabled { + defaults.agent.get_or_insert_default().dock = Some(DockPosition::Left); + defaults.project_panel.get_or_insert_default().dock = Some(DockSide::Right); + defaults.outline_panel.get_or_insert_default().dock = Some(DockSide::Right); + defaults.collaboration_panel.get_or_insert_default().dock = + Some(DockPosition::Right); + defaults.git_panel.get_or_insert_default().dock = Some(DockPosition::Right); + defaults.notification_panel.get_or_insert_default().button = Some(false); + } else { + defaults.agent.get_or_insert_default().dock = Some(DockPosition::Right); + defaults.project_panel.get_or_insert_default().dock = Some(DockSide::Left); + defaults.outline_panel.get_or_insert_default().dock = Some(DockSide::Left); + defaults.collaboration_panel.get_or_insert_default().dock = + Some(DockPosition::Left); + defaults.git_panel.get_or_insert_default().dock = Some(DockPosition::Left); + defaults.notification_panel.get_or_insert_default().button = Some(true); + } + }); + }); + }) + .detach(); } fn update_command_palette_filter(cx: &mut App) { diff --git a/crates/collab_ui/src/collab_panel.rs b/crates/collab_ui/src/collab_panel.rs index 34595e9440f518a23128e4a00ba909cec055b1e2..63fe636dab3cf756ef8cee5eb2f31e45d69c6cdc 100644 --- a/crates/collab_ui/src/collab_panel.rs +++ b/crates/collab_ui/src/collab_panel.rs @@ -3229,7 +3229,7 @@ impl Panel for CollabPanel { } fn activation_priority(&self) -> u32 { - 6 + 5 } } diff --git a/crates/collab_ui/src/notification_panel.rs b/crates/collab_ui/src/notification_panel.rs index 4374349b15f1c8e6404c61648fed720550e31a3e..be11132ac0a781a69a7b2471d9fb96f447e113f7 100644 --- a/crates/collab_ui/src/notification_panel.rs +++ b/crates/collab_ui/src/notification_panel.rs @@ -690,7 +690,7 @@ impl Panel for NotificationPanel { } fn activation_priority(&self) -> u32 { - 8 + 3 } } diff --git a/crates/outline_panel/src/outline_panel.rs b/crates/outline_panel/src/outline_panel.rs index c4d491db923b4151855d2c45461e370d061537ab..cad070392c5279ec3a6aeea0dbf22f6b9585b31f 100644 --- a/crates/outline_panel/src/outline_panel.rs +++ b/crates/outline_panel/src/outline_panel.rs @@ -5069,7 +5069,7 @@ impl Panel for OutlinePanel { } fn activation_priority(&self) -> u32 { - 5 + 6 } } diff --git a/crates/settings/src/settings_store.rs b/crates/settings/src/settings_store.rs index 26425faf113a9dc0f52ad04809dc71c2f89eeb69..cc5a9105d69d2b35cdff6f10b49e08e0f9a506cb 100644 --- a/crates/settings/src/settings_store.rs +++ b/crates/settings/src/settings_store.rs @@ -793,6 +793,17 @@ impl SettingsStore { edits } + /// Mutates the default settings in place and recomputes all setting values. + pub fn update_default_settings( + &mut self, + cx: &mut App, + update: impl FnOnce(&mut SettingsContent), + ) { + let default_settings = Rc::make_mut(&mut self.default_settings); + update(default_settings); + self.recompute_values(None, cx); + } + /// Sets the default settings via a JSON string. /// /// The string should contain a JSON object with a default value for every setting. diff --git a/crates/workspace/src/dock.rs b/crates/workspace/src/dock.rs index 44a24f687a49552f707d968e82d19387b74b0ac1..1774539559cd75e621dc8e37261872294746a325 100644 --- a/crates/workspace/src/dock.rs +++ b/crates/workspace/src/dock.rs @@ -911,7 +911,7 @@ impl Render for PanelButtons { DockPosition::Bottom | DockPosition::Right => (Corner::BottomRight, Corner::TopRight), }; - let buttons: Vec<_> = dock + let mut buttons: Vec<_> = dock .panel_entries .iter() .enumerate() @@ -1004,12 +1004,18 @@ impl Render for PanelButtons { }) .collect(); + if dock_position == DockPosition::Right { + buttons.reverse(); + } + let has_buttons = !buttons.is_empty(); h_flex() .gap_1() .when( - has_buttons && dock.position == DockPosition::Bottom, + has_buttons + && (dock.position == DockPosition::Bottom + || dock.position == DockPosition::Right), |this| this.child(Divider::vertical().color(DividerColor::Border)), ) .children(buttons) diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index 10d8c0d5974fc1c3a097a3d09c34f107f7840877..3d933e35c684fbf55d401d28831e5e844b456e16 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -2461,7 +2461,7 @@ mod tests { .update(cx, |multi_workspace, window, cx| { multi_workspace.workspace().update(cx, |workspace, cx| { assert_eq!(workspace.worktrees(cx).count(), 2); - assert!(workspace.left_dock().read(cx).is_open()); + assert!(workspace.right_dock().read(cx).is_open()); assert!( workspace .active_pane() @@ -2520,7 +2520,7 @@ mod tests { .collect::>(), &[Path::new(path!("/root/e")).into()] ); - assert!(workspace.left_dock().read(cx).is_open()); + assert!(workspace.right_dock().read(cx).is_open()); assert!(workspace.active_pane().focus_handle(cx).is_focused(window)); }) .unwrap();