aboutsummaryrefslogtreecommitdiff
path: root/src/app/mod.rs
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-05-30 01:53:55 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-05-30 01:55:36 +0300
commit8df1639048529b383358000879b5ee078a90b9f9 (patch)
tree7b0088246c3cc0834ed04cf20bf9726645bdb040 /src/app/mod.rs
parent817a1562db9156e34f13487344ea147618f9070b (diff)
fix: use login shells for macos panes
refs #350
Diffstat (limited to 'src/app/mod.rs')
-rw-r--r--src/app/mod.rs46
1 files changed, 45 insertions, 1 deletions
diff --git a/src/app/mod.rs b/src/app/mod.rs
index 1291d2a0..d8071c4d 100644
--- a/src/app/mod.rs
+++ b/src/app/mod.rs
@@ -289,6 +289,7 @@ impl App {
80,
config.advanced.scrollback_limit_bytes,
&config.terminal.default_shell,
+ config.terminal.shell_mode,
config.session.resume_agents_on_restore,
event_tx.clone(),
render_notify.clone(),
@@ -499,6 +500,7 @@ impl App {
cjk_ime_cursor_shape: config.experimental.cjk_ime_cursor_shape.to_decscusr(),
kitty_graphics_enabled: config.experimental.kitty_graphics,
default_shell: config.terminal.default_shell.clone(),
+ shell_mode: config.terminal.shell_mode,
new_terminal_cwd: config.terminal.new_cwd.clone(),
pane_scrollback_limit_bytes: config.advanced.scrollback_limit_bytes,
accent: crate::config::parse_color(&config.ui.accent),
@@ -606,6 +608,7 @@ impl App {
snapshot,
config.advanced.scrollback_limit_bytes,
&config.terminal.default_shell,
+ config.terminal.shell_mode,
imports,
app.event_tx.clone(),
app.render_notify.clone(),
@@ -1143,6 +1146,7 @@ impl App {
if !invalid_section("terminal") {
self.state.default_shell = config.terminal.default_shell.clone();
+ self.state.shell_mode = config.terminal.shell_mode;
self.state.new_terminal_cwd = config.terminal.new_cwd.clone();
}
@@ -1707,7 +1711,7 @@ mod tests {
std::fs::create_dir_all(path.parent().unwrap()).unwrap();
std::fs::write(
&path,
- "[terminal]\ndefault_shell = \"nu\"\nnew_cwd = \"home\"\n[keys]\nnew_workspace = \"prefix+m\"\nprefix = \"ctrl+a\"\n[ui]\nagent_panel_scope = \"current\"\nredraw_on_focus_gained = false\n[ui.toast]\ndelivery = \"herdr\"\n",
+ "[terminal]\ndefault_shell = \"nu\"\nshell_mode = \"non_login\"\nnew_cwd = \"home\"\n[keys]\nnew_workspace = \"prefix+m\"\nprefix = \"ctrl+a\"\n[ui]\nagent_panel_scope = \"current\"\nredraw_on_focus_gained = false\n[ui.toast]\ndelivery = \"herdr\"\n",
)
.unwrap();
std::env::set_var(crate::config::CONFIG_PATH_ENV_VAR, &path);
@@ -1735,6 +1739,10 @@ mod tests {
assert!(app.state.request_client_config_reload);
assert_eq!(app.state.default_shell, "nu");
assert_eq!(
+ app.state.shell_mode,
+ crate::config::ShellModeConfig::NonLogin
+ );
+ assert_eq!(
app.state.new_terminal_cwd,
crate::config::NewTerminalCwdConfig::Home
);
@@ -1996,6 +2004,42 @@ mod tests {
}
#[test]
+ fn reload_config_preserves_invalid_terminal_section_but_applies_valid_ui() {
+ let _guard = config_env_lock().lock().unwrap();
+ let path = temp_config_path("reload-config-invalid-terminal-section");
+ std::fs::create_dir_all(path.parent().unwrap()).unwrap();
+ std::fs::write(
+ &path,
+ "[terminal]\ndefault_shell = \"nu\"\nshell_mode = \"sideways\"\nnew_cwd = \"home\"\n[ui.toast]\ndelivery = \"terminal\"\n",
+ )
+ .unwrap();
+ std::env::set_var(crate::config::CONFIG_PATH_ENV_VAR, &path);
+
+ let mut app = test_app();
+ let original_default_shell = app.state.default_shell.clone();
+ let original_shell_mode = app.state.shell_mode;
+ let original_new_cwd = app.state.new_terminal_cwd.clone();
+ let report = app.reload_config();
+
+ assert_eq!(report.status, crate::config::ConfigReloadStatus::Partial);
+ assert_eq!(app.state.default_shell, original_default_shell);
+ assert_eq!(app.state.shell_mode, original_shell_mode);
+ assert_eq!(app.state.new_terminal_cwd, original_new_cwd);
+ assert_eq!(
+ app.state.toast_config.delivery,
+ crate::config::ToastDelivery::Terminal
+ );
+ assert!(app
+ .state
+ .config_diagnostic
+ .as_deref()
+ .is_some_and(|message| message.contains("invalid terminal config")));
+
+ std::env::remove_var(crate::config::CONFIG_PATH_ENV_VAR);
+ let _ = std::fs::remove_dir_all(path.parent().unwrap());
+ }
+
+ #[test]
fn settings_save_toast_delivery_persists_then_applies_live_config() {
let _guard = config_env_lock().lock().unwrap();
let path = temp_config_path("settings-save-toast-delivery");