Prevent toggle_dock
from opening assistant panel when it is disabled via settings (#27215)
Part of #27171 Follows-up the change in https://github.com/zed-industries/zed/pull/22346 to consider the case where the assistant-panel is disabled via settings (as also noted in [this comment](https://github.com/zed-industries/zed/pull/22346#issuecomment-2558372412), Notably, only the explicit case is considered here. Can extend this change to also cover the implicit case where the button is disabled if requested.). Currently, if the user toggles the right dock, the assistant panel will be shown even if it is disabled via settings, because it has the highest priority (see https://github.com/zed-industries/zed/pull/22346#issuecomment-2564890493). With this change, the assistant panel is no longer activated when disabled and the dock with the next highest activation order is activated instead. I did not opt in to make the priority configurabe, as I agree with https://github.com/zed-industries/zed/pull/22346#issuecomment-2564890493 that this will most likely rarely be used (the active panel is only none on the first toggle of the dock, afterwards it remains set for the remainder of the session). Release Notes: - `workspace::ToggleRightDock` will no longer open the assistant panel when it is disabled via settings.
This commit is contained in:
parent
a360365410
commit
ca9fb2399e
7 changed files with 81 additions and 49 deletions
|
@ -1156,20 +1156,7 @@ impl Panel for ChatPanel {
|
|||
}
|
||||
|
||||
fn icon(&self, _window: &Window, cx: &App) -> Option<ui::IconName> {
|
||||
let show_icon = match ChatPanelSettings::get_global(cx).button {
|
||||
ChatPanelButton::Never => false,
|
||||
ChatPanelButton::Always => true,
|
||||
ChatPanelButton::WhenInCall => {
|
||||
let is_in_call = ActiveCall::global(cx)
|
||||
.read(cx)
|
||||
.room()
|
||||
.map_or(false, |room| room.read(cx).contains_guests());
|
||||
|
||||
self.active || is_in_call
|
||||
}
|
||||
};
|
||||
|
||||
show_icon.then(|| ui::IconName::MessageBubbles)
|
||||
self.enabled(cx).then(|| ui::IconName::MessageBubbles)
|
||||
}
|
||||
|
||||
fn icon_tooltip(&self, _: &Window, _: &App) -> Option<&'static str> {
|
||||
|
@ -1190,6 +1177,21 @@ impl Panel for ChatPanel {
|
|||
fn activation_priority(&self) -> u32 {
|
||||
7
|
||||
}
|
||||
|
||||
fn enabled(&self, cx: &App) -> bool {
|
||||
match ChatPanelSettings::get_global(cx).button {
|
||||
ChatPanelButton::Never => false,
|
||||
ChatPanelButton::Always => true,
|
||||
ChatPanelButton::WhenInCall => {
|
||||
let is_in_call = ActiveCall::global(cx)
|
||||
.read(cx)
|
||||
.room()
|
||||
.map_or(false, |room| room.read(cx).contains_guests());
|
||||
|
||||
self.active || is_in_call
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl EventEmitter<PanelEvent> for ChatPanel {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue