Feat/shell tmux git tooling #20
@@ -6,6 +6,7 @@
|
||||
pkgs,
|
||||
config,
|
||||
inputs,
|
||||
lib,
|
||||
username,
|
||||
...
|
||||
}:
|
||||
@@ -95,4 +96,25 @@
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Auto-start tmux in graphical terminals (foot): opening a terminal drops
|
||||
# straight into a session named "main" (attach if it exists, else create).
|
||||
# Panes inside run a plain non-login zsh (tmux's default-command "${SHELL}").
|
||||
# Order 200 runs this before oh-my-zsh/compinit so the exec replaces the shell
|
||||
# before that setup is wasted. Guards (each prevents a real breakage):
|
||||
# interactive only -> don't hijack scp/ssh-command/non-interactive shells
|
||||
# $TMUX empty -> a pane's zsh won't re-exec tmux (infinite loop)
|
||||
# not SSH -> don't force inbound SSH logins into a server tmux
|
||||
# not VS Code -> its integrated terminal manages itself
|
||||
# tmux on PATH -> exec failure would otherwise kill the login shell
|
||||
# Lives here (graphical hosts only); the WSL work box never imports this.
|
||||
programs.zsh.initContent = lib.mkOrder 200 ''
|
||||
if [[ $- == *i* ]] \
|
||||
&& [[ -z "$TMUX" ]] \
|
||||
&& [[ -z "$SSH_CONNECTION" && -z "$SSH_TTY" ]] \
|
||||
&& [[ "$TERM_PROGRAM" != "vscode" ]] \
|
||||
&& command -v tmux >/dev/null 2>&1; then
|
||||
exec tmux new-session -A -s main
|
||||
fi
|
||||
'';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user