added env var to disable 'new' command from running rc

This commit is contained in:
Valerie Wolfe 2024-07-12 09:19:04 -04:00
parent bf67610ccb
commit 6ce1f354c4
2 changed files with 11 additions and 7 deletions

View file

@ -188,11 +188,14 @@ pub fn new(state: &mut State) {
.new_name(&window_name); .new_name(&window_name);
tmux = tmux.add_command(auto_name); tmux = tmux.add_command(auto_name);
if let Some(mut scripts) = script::list() { let rc_var = env_var(env::NEW_RC);
if let Some(path) = scripts.remove(&window_name) { if !(rc_var.is_empty() || rc_var == "0") {
let rc = commands::SourceFile::new() if let Some(mut scripts) = script::list() {
.path(path); if let Some(path) = scripts.remove(&window_name) {
tmux = tmux.add_command(rc); let rc = commands::SourceFile::new()
.path(path);
tmux = tmux.add_command(rc);
}
} }
} }
} }

View file

@ -2,9 +2,10 @@ use std::env::var;
pub type EnvVar = (&'static str, &'static str); pub type EnvVar = (&'static str, &'static str);
pub static ATTACH_SYMBOL: EnvVar = ("REMUX_ATTACH_SYMBOL", "*"); pub static ATTACH_SYMBOL: EnvVar = ("REMUX_ATTACH_SYMBOL", "*");
pub static CURRENT_SYMBOL: EnvVar = ("REMUX_CURRENT_SYMBOL", ">"); pub static CURRENT_SYMBOL: EnvVar = ("REMUX_CURRENT_SYMBOL", ">");
pub static NEW_WINDOW_NAME: EnvVar = ("REMUX_NEW_WINDOW", ""); pub static NEW_WINDOW_NAME: EnvVar = ("REMUX_NEW_WINDOW", "");
pub static NEW_RC: EnvVar = ("REMUX_NEW_RC", "1");
pub static TMUX: &str = "TMUX"; pub static TMUX: &str = "TMUX";