@@ -4208,7 +4208,11 @@ impl AcpThreadView {
}
}))
.on_action(cx.listener(|this, _: &CycleModeSelector, window, cx| {
- if let Some(mode_selector) = this.mode_selector() {
+ if let Some(profile_selector) = this.profile_selector.as_ref() {
+ profile_selector.update(cx, |profile_selector, cx| {
+ profile_selector.cycle_profile(cx);
+ });
+ } else if let Some(mode_selector) = this.mode_selector() {
mode_selector.update(cx, |mode_selector, cx| {
mode_selector.cycle_mode(window, cx);
});
@@ -1,4 +1,4 @@
-use crate::{ManageProfiles, ToggleProfileSelector};
+use crate::{CycleModeSelector, ManageProfiles, ToggleProfileSelector};
use agent_settings::{
AgentProfile, AgentProfileId, AgentSettings, AvailableProfiles, builtin_profiles,
};
@@ -70,6 +70,29 @@ impl ProfileSelector {
self.picker_handle.clone()
}
+ pub fn cycle_profile(&mut self, cx: &mut Context<Self>) {
+ if !self.provider.profiles_supported(cx) {
+ return;
+ }
+
+ let profiles = AgentProfile::available_profiles(cx);
+ if profiles.is_empty() {
+ return;
+ }
+
+ let current_profile_id = self.provider.profile_id(cx);
+ let current_index = profiles
+ .keys()
+ .position(|id| id == ¤t_profile_id)
+ .unwrap_or(0);
+
+ let next_index = (current_index + 1) % profiles.len();
+
+ if let Some((next_profile_id, _)) = profiles.get_index(next_index) {
+ self.provider.set_profile(next_profile_id.clone(), cx);
+ }
+ }
+
fn ensure_picker(
&mut self,
window: &mut Window,
@@ -163,14 +186,29 @@ impl Render for ProfileSelector {
PickerPopoverMenu::new(
picker,
trigger_button,
- move |_window, cx| {
- Tooltip::for_action_in(
- "Toggle Profile Menu",
- &ToggleProfileSelector,
- &focus_handle,
- cx,
- )
- },
+ Tooltip::element({
+ move |_window, cx| {
+ let container = || h_flex().gap_1().justify_between();
+ v_flex()
+ .gap_1()
+ .child(
+ container()
+ .pb_1()
+ .border_b_1()
+ .border_color(cx.theme().colors().border_variant)
+ .child(Label::new("Cycle Through Profiles"))
+ .child(KeyBinding::for_action_in(
+ &CycleModeSelector,
+ &focus_handle,
+ cx,
+ )),
+ )
+ .child(container().child(Label::new("Toggle Profile Menu")).child(
+ KeyBinding::for_action_in(&ToggleProfileSelector, &focus_handle, cx),
+ ))
+ .into_any()
+ }
+ }),
gpui::Corner::BottomRight,
cx,
)