From 2b97799b6715fd6c355db9c225029765971915e6 Mon Sep 17 00:00:00 2001 From: Ogulcan Celik Date: Wed, 20 May 2026 00:29:53 +0300 Subject: feat: add configurable default shell refs #196 --- src/config/io.rs | 8 ++++++++ src/config/model.rs | 21 +++++++++++++++++++++ 2 files changed, 29 insertions(+) (limited to 'src/config') diff --git a/src/config/io.rs b/src/config/io.rs index 268a1e8b..07b63d37 100644 --- a/src/config/io.rs +++ b/src/config/io.rs @@ -160,6 +160,14 @@ fn load_live_config_from_str(content: &str) -> Result> &mut invalid_sections, |section| config.keys = section, ); + load_live_section( + table, + "terminal", + "terminal config", + &mut diagnostics, + &mut invalid_sections, + |section| config.terminal = section, + ); load_live_section( table, "ui", diff --git a/src/config/model.rs b/src/config/model.rs index 673eec02..ff3a7b22 100644 --- a/src/config/model.rs +++ b/src/config/model.rs @@ -34,6 +34,13 @@ pub struct ToastConfig { pub delivery: ToastDelivery, } +#[derive(Debug, Default, Deserialize)] +#[serde(default)] +pub struct TerminalConfig { + /// Executable used for new interactive panes. Empty means SHELL, then /bin/sh. + pub default_shell: String, +} + #[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, Serialize)] #[serde(rename_all = "snake_case")] pub enum ConfigReloadStatus { @@ -66,6 +73,7 @@ pub fn validated_sidebar_bounds(min: u16, max: u16) -> Option<(u16, u16)> { pub struct Config { pub onboarding: Option, pub theme: ThemeConfig, + pub terminal: TerminalConfig, pub keys: KeysConfig, pub ui: UiConfig, pub advanced: AdvancedConfig, @@ -297,6 +305,19 @@ impl Default for AdvancedConfig { mod tests { use super::*; + #[test] + fn terminal_default_shell_defaults_empty_and_parses() { + let default_config = Config::default(); + assert!(default_config.terminal.default_shell.is_empty()); + + let toml = r#" +[terminal] +default_shell = "nu" +"#; + let config: Config = toml::from_str(toml).unwrap(); + assert_eq!(config.terminal.default_shell, "nu"); + } + #[test] fn agent_panel_scope_config_parses() { let toml = r#" -- cgit v1.2.3