the runtime your coding agents live on
Rust agentagent-orchestrationaiai-agentsclaude-codeclicodexcoding-agentsdeveloper-toolsdevtoolsmultiplexerrustterminalterminal-multiplexerterminal-uitmuxtuiworkspace-manager
feat: add configurable default shell
Ogulcan Celik2b97799b6715
diff --git a/docs/next/CHANGELOG.md b/docs/next/CHANGELOG.mdindex 152c794c9..8a487d90e 100644--- a/docs/next/CHANGELOG.md+++ b/docs/next/CHANGELOG.md@@ -4,6 +4,7 @@### Added- Added an integrations tab in settings and first-run onboarding so users can install recommended agent integrations from inside Herdr.+- Added `terminal.default_shell` to choose the executable used for new interactive panes. When unset, Herdr still falls back to `$SHELL`, then `/bin/sh`. (#196)## [0.5.12] - 2026-05-19diff --git a/docs/next/website/src/content/docs/configuration.mdx b/docs/next/website/src/content/docs/configuration.mdxindex d8d106ecc..317dc4d28 100644--- a/docs/next/website/src/content/docs/configuration.mdx+++ b/docs/next/website/src/content/docs/configuration.mdx@@ -45,6 +45,17 @@ You can also open the global menu in Herdr and choose `reload config`.Reload applies most UI settings without restarting panes. Startup-only settings still need a restart.+## Default shell++Set the executable Herdr uses for newly created interactive panes:++```toml+[terminal]+default_shell = "nu"+```++When unset or empty, Herdr uses `$SHELL`, then `/bin/sh`. This is an executable name or path, not a shell command line. Existing panes keep their current shell until they are recreated. Command panes still run through `/bin/sh -c`; detached custom command keybindings use Herdr's existing `/bin/sh -lc` path.+## KeybindingsHerdr has a prefix mode similar to tmux. The default prefix is `ctrl+b`.diff --git a/src/app/api.rs b/src/app/api.rsindex ab26f82b0..6eb95f036 100644--- a/src/app/api.rs+++ b/src/app/api.rs@@ -637,6 +637,9 @@ impl App {.or_else(|| std::env::current_dir().ok()).unwrap_or_else(|| std::path::PathBuf::from("/"));let (rows, cols) = self.state.estimate_pane_size();+ let default_shell = self.state.default_shell.clone();+ let scrollback_limit_bytes = self.state.pane_scrollback_limit_bytes;+ let host_terminal_theme = self.state.host_terminal_theme;let result = self.state.workspaces@@ -647,8 +650,9 @@ impl App {rows,cols,cwd,- self.state.pane_scrollback_limit_bytes,- self.state.host_terminal_theme,+ scrollback_limit_bytes,+ host_terminal_theme,+ &default_shell,)});match result {@@ -1019,6 +1023,9 @@ impl App {)})});+ let default_shell = self.state.default_shell.clone();+ let scrollback_limit_bytes = self.state.pane_scrollback_limit_bytes;+ let host_terminal_theme = self.state.host_terminal_theme;let Some(ws) = self.state.workspaces.get_mut(ws_idx) else {return serde_json::to_string(&ErrorResponse {id: request.id,@@ -1043,8 +1050,9 @@ impl App {rows,cols,split_cwd,- self.state.pane_scrollback_limit_bytes,- self.state.host_terminal_theme,+ scrollback_limit_bytes,+ host_terminal_theme,+ &default_shell,params.focus,) {Some(Ok(result)) => result,diff --git a/src/app/creation.rs b/src/app/creation.rsindex f1638e157..f3d8644e5 100644--- a/src/app/creation.rs+++ b/src/app/creation.rs@@ -87,6 +87,7 @@ impl App {initial_cwd,self.state.pane_scrollback_limit_bytes,self.state.host_terminal_theme,+ &self.state.default_shell,)?;self.state.terminal_runtimes@@ -118,6 +119,7 @@ impl App {cols,self.state.pane_scrollback_limit_bytes,self.state.host_terminal_theme,+ &self.state.default_shell,self.event_tx.clone(),self.render_notify.clone(),self.render_dirty.clone(),diff --git a/src/app/input/mod.rs b/src/app/input/mod.rsindex ad68f9da9..4cafc926f 100644--- a/src/app/input/mod.rs+++ b/src/app/input/mod.rs@@ -259,6 +259,7 @@ impl AppState {cwd,self.pane_scrollback_limit_bytes,self.host_terminal_theme,+ &self.default_shell,) {let new_id = new_pane.pane_id;self.terminal_runtimesdiff --git a/src/app/input/navigate.rs b/src/app/input/navigate.rsindex 34d0a3425..a2967ca36 100644--- a/src/app/input/navigate.rs+++ b/src/app/input/navigate.rs@@ -1092,6 +1092,7 @@ mod tests {80,app.state.pane_scrollback_limit_bytes,app.state.host_terminal_theme,+ &app.state.default_shell,app.event_tx.clone(),app.render_notify.clone(),app.render_dirty.clone(),diff --git a/src/app/mod.rs b/src/app/mod.rsindex 3e8a8b83b..ca053ba18 100644--- a/src/app/mod.rs+++ b/src/app/mod.rs@@ -234,6 +234,7 @@ impl App {24,80,config.advanced.scrollback_limit_bytes,+ &config.terminal.default_shell,event_tx.clone(),render_notify.clone(),render_dirty.clone(),@@ -412,6 +413,7 @@ impl App {prompt_new_tab_name: config.ui.prompt_new_tab_name,show_agent_labels_on_pane_borders: config.ui.show_agent_labels_on_pane_borders,kitty_graphics_enabled: config.experimental.kitty_graphics,+ default_shell: config.terminal.default_shell.clone(),pane_scrollback_limit_bytes: config.advanced.scrollback_limit_bytes,accent: crate::config::parse_color(&config.ui.accent),sound: config.ui.sound.clone(),@@ -891,6 +893,10 @@ impl App {self.state.pane_scrollback_limit_bytes = config.advanced.scrollback_limit_bytes;}+ if !invalid_section("terminal") {+ self.state.default_shell = config.terminal.default_shell.clone();+ }+if !invalid_section("theme") {self.state.palette = resolve_palette_with_legacy_accent(config, !invalid_section("ui"));self.state.theme_name = config@@ -1321,7 +1327,7 @@ mod tests {std::fs::create_dir_all(path.parent().unwrap()).unwrap();std::fs::write(&path,- "[keys]\nnew_workspace = \"g\"\nprefix = \"ctrl+a\"\n[ui]\nagent_panel_scope = \"current\"\n[ui.toast]\ndelivery = \"herdr\"\n",+ "[terminal]\ndefault_shell = \"nu\"\n[keys]\nnew_workspace = \"g\"\nprefix = \"ctrl+a\"\n[ui]\nagent_panel_scope = \"current\"\n[ui.toast]\ndelivery = \"herdr\"\n",).unwrap();std::env::set_var(crate::config::CONFIG_PATH_ENV_VAR, &path);@@ -1344,6 +1350,7 @@ mod tests {app.state.agent_panel_scope,state::AgentPanelScope::CurrentWorkspace);+ assert_eq!(app.state.default_shell, "nu");assert!(app.state.config_diagnostic.is_none());let toast = app.state.toast.as_ref().unwrap();assert_eq!(toast.kind, crate::app::state::ToastKind::UpdateInstalled);diff --git a/src/app/state.rs b/src/app/state.rsindex 746474df0..0c38171d5 100644--- a/src/app/state.rs+++ b/src/app/state.rs@@ -965,6 +965,7 @@ pub struct AppState {pub prompt_new_tab_name: bool,pub show_agent_labels_on_pane_borders: bool,pub kitty_graphics_enabled: bool,+ pub default_shell: String,pub pane_scrollback_limit_bytes: usize,#[allow(dead_code)] // kept for backward compat; palette.accent is the source of truthpub accent: Color,@@ -1211,6 +1212,7 @@ impl AppState {prompt_new_tab_name: true,show_agent_labels_on_pane_borders: false,kitty_graphics_enabled: false,+ default_shell: String::new(),pane_scrollback_limit_bytes: crate::config::DEFAULT_SCROLLBACK_LIMIT_BYTES,accent: Color::Cyan,sound: SoundConfig {diff --git a/src/config/io.rs b/src/config/io.rsindex 268a1e8b7..07b63d376 100644--- a/src/config/io.rs+++ b/src/config/io.rs@@ -160,6 +160,14 @@ fn load_live_config_from_str(content: &str) -> Result<LoadedConfig, Vec<String>>&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.rsindex 673eec027..ff3a7b224 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<bool>,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#"diff --git a/src/main.rs b/src/main.rsindex c88113282..0814c09e6 100644--- a/src/main.rs+++ b/src/main.rs@@ -75,6 +75,11 @@ const DEFAULT_CONFIG: &str = r##"# herdr configuration# red = "#ff6188"# green = "#a6e3a1"+[terminal]+# Executable used for new interactive panes.+# Empty means $SHELL, then /bin/sh.+# default_shell = ""+[keys]# Prefix key to enter navigate mode (default: "ctrl+b")# Examples: "ctrl+b", "f12", "esc", "-"diff --git a/src/pane.rs b/src/pane.rsindex aba31943f..10112f0f0 100644--- a/src/pane.rs+++ b/src/pane.rs@@ -250,6 +250,22 @@ fn shutdown_pane_processes(pane_id: PaneId, child_pid: u32) {);}+fn pane_shell(configured_shell: &str) -> String {+ pane_shell_from(configured_shell, std::env::var("SHELL").ok())+}++fn pane_shell_from(configured_shell: &str, env_shell: Option<String>) -> String {+ let configured_shell = configured_shell.trim();+ if !configured_shell.is_empty() {+ return configured_shell.to_string();+ }++ env_shell+ .map(|shell| shell.trim().to_string())+ .filter(|shell| !shell.is_empty())+ .unwrap_or_else(|| "/bin/sh".into())+}+impl PaneRuntime {pub fn shutdown(self) {self.detect_handle.abort();@@ -267,11 +283,12 @@ impl PaneRuntime {cwd: std::path::PathBuf,scrollback_limit_bytes: usize,host_terminal_theme: crate::terminal_theme::TerminalTheme,+ default_shell: &str,events: mpsc::Sender<AppEvent>,render_notify: Arc<Notify>,render_dirty: Arc<AtomicBool>,) -> std::io::Result<Self> {- let shell = std::env::var("SHELL").unwrap_or_else(|_| "/bin/sh".into());+ let shell = pane_shell(default_shell);let mut cmd = CommandBuilder::new(&shell);cmd.cwd(cwd);cmd.env(crate::HERDR_ENV_VAR, crate::HERDR_ENV_VALUE);@@ -1099,6 +1116,28 @@ mod tests {output}+ #[test]+ fn pane_shell_prefers_configured_shell() {+ assert_eq!(+ pane_shell_from("/usr/bin/nu", Some("/bin/bash".to_string())),+ "/usr/bin/nu"+ );+ }++ #[test]+ fn pane_shell_falls_back_to_shell_env() {+ assert_eq!(+ pane_shell_from("", Some("/bin/bash".to_string())),+ "/bin/bash"+ );+ }++ #[test]+ fn pane_shell_ignores_empty_values() {+ assert_eq!(pane_shell_from(" ", Some(" ".to_string())), "/bin/sh");+ assert_eq!(pane_shell_from("", None), "/bin/sh");+ }+#[test]fn pane_terminal_identity_overrides_outer_terminal_env() {let output = capture_shell_output("printf '%s\\n%s\\n' \"$TERM\" \"$COLORTERM\"", &[]);diff --git a/src/persist/restore.rs b/src/persist/restore.rsindex 0ac49e805..f558761d4 100644--- a/src/persist/restore.rs+++ b/src/persist/restore.rs@@ -21,6 +21,7 @@ pub fn restore(rows: u16,cols: u16,scrollback_limit_bytes: usize,+ default_shell: &str,events: mpsc::Sender<AppEvent>,render_notify: Arc<Notify>,render_dirty: Arc<AtomicBool>,@@ -38,6 +39,7 @@ pub fn restore(rows,cols,scrollback_limit_bytes,+ default_shell,events.clone(),render_notify.clone(),render_dirty.clone(),@@ -57,6 +59,7 @@ fn restore_workspace(rows: u16,cols: u16,scrollback_limit_bytes: usize,+ default_shell: &str,events: mpsc::Sender<AppEvent>,render_notify: Arc<Notify>,render_dirty: Arc<AtomicBool>,@@ -78,6 +81,7 @@ fn restore_workspace(rows,cols,scrollback_limit_bytes,+ default_shell,events.clone(),render_notify.clone(),render_dirty.clone(),@@ -123,6 +127,7 @@ fn restore_tab(rows: u16,cols: u16,scrollback_limit_bytes: usize,+ default_shell: &str,events: mpsc::Sender<AppEvent>,render_notify: Arc<Notify>,render_dirty: Arc<AtomicBool>,@@ -181,6 +186,7 @@ fn restore_tab(cwd.clone(),scrollback_limit_bytes,crate::terminal_theme::TerminalTheme::default(),+ default_shell,events.clone(),render_notify.clone(),render_dirty.clone(),diff --git a/src/workspace.rs b/src/workspace.rsindex 69a83d75e..47fa9cf7e 100644--- a/src/workspace.rs+++ b/src/workspace.rs@@ -89,6 +89,7 @@ impl Workspace {cols: u16,scrollback_limit_bytes: usize,host_terminal_theme: crate::terminal_theme::TerminalTheme,+ default_shell: &str,events: mpsc::Sender<AppEvent>,render_notify: Arc<Notify>,render_dirty: Arc<AtomicBool>,@@ -99,6 +100,7 @@ impl Workspace {cols,scrollback_limit_bytes,host_terminal_theme,+ default_shell,events,render_notify,render_dirty,@@ -123,6 +125,7 @@ impl Workspace {cols,scrollback_limit_bytes,host_terminal_theme,+ "",events,render_notify,render_dirty,@@ -137,6 +140,7 @@ impl Workspace {cols: u16,scrollback_limit_bytes: usize,host_terminal_theme: crate::terminal_theme::TerminalTheme,+ default_shell: &str,events: mpsc::Sender<AppEvent>,render_notify: Arc<Notify>,render_dirty: Arc<AtomicBool>,@@ -163,6 +167,7 @@ impl Workspace {cols,scrollback_limit_bytes,host_terminal_theme,+ default_shell,events,render_notify,render_dirty,@@ -223,6 +228,7 @@ impl Workspace {cwd: PathBuf,scrollback_limit_bytes: usize,host_terminal_theme: crate::terminal_theme::TerminalTheme,+ default_shell: &str,) -> std::io::Result<(usize, TerminalState, TerminalRuntime)> {self.create_tab_with_runtime(rows,@@ -230,6 +236,7 @@ impl Workspace {cwd,scrollback_limit_bytes,host_terminal_theme,+ default_shell,None,)}@@ -241,6 +248,7 @@ impl Workspace {cwd: PathBuf,scrollback_limit_bytes: usize,host_terminal_theme: crate::terminal_theme::TerminalTheme,+ default_shell: &str,argv: Option<&[String]>,) -> std::io::Result<(usize, TerminalState, TerminalRuntime)> {let number = self.tabs.len() + 1;@@ -278,6 +286,7 @@ impl Workspace {cols,scrollback_limit_bytes,host_terminal_theme,+ default_shell,events,render_notify,render_dirty,@@ -343,6 +352,7 @@ impl Workspace {cwd: Option<PathBuf>,scrollback_limit_bytes: usize,host_terminal_theme: crate::terminal_theme::TerminalTheme,+ default_shell: &str,) -> std::io::Result<crate::workspace::tab::NewPane> {let new_pane = self.active_tab_mut()@@ -354,6 +364,7 @@ impl Workspace {cwd,scrollback_limit_bytes,host_terminal_theme,+ default_shell,)?;self.register_new_pane(new_pane.pane_id);Ok(new_pane)@@ -368,6 +379,7 @@ impl Workspace {cwd: Option<PathBuf>,scrollback_limit_bytes: usize,host_terminal_theme: crate::terminal_theme::TerminalTheme,+ default_shell: &str,focus_new_pane: bool,) -> Option<std::io::Result<(usize, crate::workspace::tab::NewPane)>> {self.split_pane_with_runtime(@@ -378,6 +390,7 @@ impl Workspace {cwd,scrollback_limit_bytes,host_terminal_theme,+ default_shell,focus_new_pane,None,)@@ -404,6 +417,7 @@ impl Workspace {cwd,scrollback_limit_bytes,host_terminal_theme,+ "",focus_new_pane,Some(argv),)@@ -419,6 +433,7 @@ impl Workspace {cwd: Option<PathBuf>,scrollback_limit_bytes: usize,host_terminal_theme: crate::terminal_theme::TerminalTheme,+ default_shell: &str,focus_new_pane: bool,argv: Option<&[String]>,) -> Option<std::io::Result<(usize, crate::workspace::tab::NewPane)>> {@@ -444,6 +459,7 @@ impl Workspace {cwd,scrollback_limit_bytes,host_terminal_theme,+ default_shell,)} {Ok(new_pane) => new_pane,diff --git a/src/workspace/tab.rs b/src/workspace/tab.rsindex 943a45a0a..3616b95cb 100644--- a/src/workspace/tab.rs+++ b/src/workspace/tab.rs@@ -53,6 +53,7 @@ impl Tab {cols: u16,scrollback_limit_bytes: usize,host_terminal_theme: crate::terminal_theme::TerminalTheme,+ default_shell: &str,events: mpsc::Sender<AppEvent>,render_notify: Arc<Notify>,render_dirty: Arc<AtomicBool>,@@ -64,6 +65,7 @@ impl Tab {cols,scrollback_limit_bytes,host_terminal_theme,+ default_shell,events,render_notify,render_dirty,@@ -90,6 +92,7 @@ impl Tab {cols,scrollback_limit_bytes,host_terminal_theme,+ "",events,render_notify,render_dirty,@@ -105,6 +108,7 @@ impl Tab {cols: u16,scrollback_limit_bytes: usize,host_terminal_theme: crate::terminal_theme::TerminalTheme,+ default_shell: &str,events: mpsc::Sender<AppEvent>,render_notify: Arc<Notify>,render_dirty: Arc<AtomicBool>,@@ -132,6 +136,7 @@ impl Tab {initial_cwd.clone(),scrollback_limit_bytes,host_terminal_theme,+ default_shell,events.clone(),render_notify.clone(),render_dirty.clone(),@@ -189,6 +194,7 @@ impl Tab {cwd: Option<PathBuf>,scrollback_limit_bytes: usize,host_terminal_theme: crate::terminal_theme::TerminalTheme,+ default_shell: &str,) -> std::io::Result<NewPane> {self.split_focused_with_runtime(direction,@@ -197,6 +203,7 @@ impl Tab {cwd,scrollback_limit_bytes,host_terminal_theme,+ default_shell,None,)}@@ -219,6 +226,7 @@ impl Tab {cwd,scrollback_limit_bytes,host_terminal_theme,+ "",Some(SplitCommand::Shell { command, extra_env }),)}@@ -240,6 +248,7 @@ impl Tab {cwd,scrollback_limit_bytes,host_terminal_theme,+ "",Some(SplitCommand::Argv { argv }),)}@@ -252,6 +261,7 @@ impl Tab {cwd: Option<PathBuf>,scrollback_limit_bytes: usize,host_terminal_theme: crate::terminal_theme::TerminalTheme,+ default_shell: &str,command: Option<SplitCommand<'_>>,) -> std::io::Result<NewPane> {let previous_focus = self.layout.focused();@@ -298,6 +308,7 @@ impl Tab {actual_cwd.clone(),scrollback_limit_bytes,host_terminal_theme,+ default_shell,self.events.clone(),self.render_notify.clone(),self.render_dirty.clone(),