diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-06-17 16:08:43 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-06-17 16:08:43 +0300 |
| commit | 54490254f70469cd154ee630bc4bec84da178f0c (patch) | |
| tree | 450bf0397398b28932f636d33e37f73c011dd19d /src/config | |
| parent | d998753efe506a04c80306795efc72bff60bb0ec (diff) | |
feat: sort agent panel by priority
refs #318
Diffstat (limited to 'src/config')
| -rw-r--r-- | src/config/model.rs | 44 |
1 files changed, 32 insertions, 12 deletions
diff --git a/src/config/model.rs b/src/config/model.rs index 95915590..c8fa7f71 100644 --- a/src/config/model.rs +++ b/src/config/model.rs @@ -84,17 +84,18 @@ pub enum ToastClipboardPosition { #[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, Serialize, Default)] #[serde(rename_all = "lowercase")] -pub enum AgentPanelScopeConfig { - Current, +pub enum AgentPanelSortConfig { #[default] - All, + #[serde(alias = "workspaces")] + Spaces, + Priority, } -impl AgentPanelScopeConfig { +impl AgentPanelSortConfig { pub fn as_str(self) -> &'static str { match self { - Self::Current => "current", - Self::All => "all", + Self::Spaces => "spaces", + Self::Priority => "priority", } } } @@ -440,8 +441,8 @@ pub struct UiConfig { pub prompt_new_tab_name: bool, /// Show agent labels in split pane borders when no manual pane label is set. Default: false. pub show_agent_labels_on_pane_borders: bool, - /// Agent sidebar scope. Saved values are "current" or "all". Default: "all". - pub agent_panel_scope: AgentPanelScopeConfig, + /// Agent sidebar ordering. Saved values are "spaces" or "priority". Default: "spaces". + pub agent_panel_sort: AgentPanelSortConfig, /// Accent color for highlights, borders, and navigation UI. /// Accepts hex (#89b4fa), named colors (cyan, blue), or RGB (rgb(137,180,250)). pub accent: String, @@ -626,7 +627,7 @@ impl Default for UiConfig { confirm_close: true, prompt_new_tab_name: true, show_agent_labels_on_pane_borders: false, - agent_panel_scope: AgentPanelScopeConfig::All, + agent_panel_sort: AgentPanelSortConfig::Spaces, accent: "cyan".into(), toast: ToastConfig::default(), sound: SoundConfig::default(), @@ -797,13 +798,32 @@ resume_agents_on_restore = false } #[test] - fn agent_panel_scope_config_parses() { + fn agent_panel_sort_config_parses_alias_and_defaults() { + assert_eq!( + Config::default().ui.agent_panel_sort, + AgentPanelSortConfig::Spaces + ); + + let toml = r#" +[ui] +agent_panel_sort = "priority" +"#; + let config: Config = toml::from_str(toml).unwrap(); + assert_eq!(config.ui.agent_panel_sort, AgentPanelSortConfig::Priority); + + let toml = r#" +[ui] +agent_panel_sort = "workspaces" +"#; + let config: Config = toml::from_str(toml).unwrap(); + assert_eq!(config.ui.agent_panel_sort, AgentPanelSortConfig::Spaces); + let toml = r#" [ui] -agent_panel_scope = "all" +agent_panel_scope = "current" "#; let config: Config = toml::from_str(toml).unwrap(); - assert_eq!(config.ui.agent_panel_scope, AgentPanelScopeConfig::All); + assert_eq!(config.ui.agent_panel_sort, AgentPanelSortConfig::Spaces); } #[test] |
