feat(shell): SSH login enters tmux before the dtach menu

Interactive SSH shell outside tmux and outside a VS Code terminal now execs
tmux new-session -A -s main; the shell inside tmux re-reads the rc and opens
the dtach-router menu there, so it no longer has to be quit and reopened.
This commit is contained in:
bchanot committed 2026-10-15 00:53:22 +02:00
1 parent 91bbe059ec
commit 30588892ae
4 files changed
+40

No files matched your search

+7
View File
@@ -174,3 +174,10 @@ Branch: feature/rust-toolchain (off develop). rustup official script, both OSes,
- [x] bash/bashrc-linux, bash/bashrc-osx, zsh/zshrc-osx: source `~/.cargo/env` when present (PATH, dedup inside)
- [x] README (step, packages lines, table), CHANGELOG Unreleased, CLAUDE.md layout line
- [x] shellcheck + bash -n + stub harness (fresh HOME: install path, re-run path); commit on the branch, no finish without signal
## Feature — SSH login enters tmux before dtach-router (2026-10-15)
Branch: feature/tmux-before-router (off develop). User always runs tmux now, so the router
menu at plain-SSH login had to be quit once, then reopened inside tmux. Approved in chat:
shared session `main` (`new-session -A`), VS Code Remote-SSH excluded, all three rc files.
- [x] bash/bashrc-linux, bash/bashrc-osx, zsh/zshrc-osx: interactive + SSH + not in tmux + not vscode → `exec tmux new-session -A -s main`, just before the router line
- [x] shellcheck + bash -n + guard harness (env combos, tmux stubbed); zsh absent here, zsh block untested
+11
View File
@@ -163,6 +163,17 @@ _repo_complete() {
complete -F _repo_complete repo
case $- in *i*) command -v repo-sync >/dev/null && (repo-sync refresh --quiet >/dev/null 2>&1 &) ;; esac
# SSH interactif hors tmux (et hors terminal VS Code Remote-SSH) : entrer dans tmux,
# session partagee "main" (rattachee si elle existe). Le shell lance dans tmux relit ce
# fichier et ouvre le menu dtach ci-dessous ; quitter tmux ferme la connexion (exec).
case $- in *i*)
if [ -n "${SSH_CONNECTION:-}" ] && [ -z "${TMUX:-}" ] \
&& [ "${TERM_PROGRAM:-}" != vscode ] && command -v tmux >/dev/null; then
exec tmux new-session -A -s main
fi
;;
esac
# Au demarrage d'un shell interactif, proposer de reprendre une session dtach existante
# (silencieux si aucune). Place ici plutot que dans ~/.profile car les terminaux VS Code
# Remote-SSH sont non-login et ne lisent pas ~/.profile ; ~/.bashrc, lui, est toujours lu.
+11
View File
@@ -173,6 +173,17 @@ _repo_complete() {
complete -F _repo_complete repo
case $- in *i*) command -v repo-sync >/dev/null && (repo-sync refresh --quiet >/dev/null 2>&1 &) ;; esac
# SSH interactif hors tmux (et hors terminal VS Code Remote-SSH) : entrer dans tmux,
# session partagee "main" (rattachee si elle existe). Le shell lance dans tmux relit ce
# fichier et ouvre le menu dtach ci-dessous ; quitter tmux ferme la connexion (exec).
case $- in *i*)
if [ -n "${SSH_CONNECTION:-}" ] && [ -z "${TMUX:-}" ] \
&& [ "${TERM_PROGRAM:-}" != vscode ] && command -v tmux >/dev/null; then
exec tmux new-session -A -s main
fi
;;
esac
# Au demarrage d'un shell interactif, proposer de reprendre une session dtach existante
# (silencieux si aucune). Place ici plutot que dans ~/.profile car les terminaux VS Code
# Remote-SSH sont non-login et ne lisent pas ~/.profile ; ~/.bashrc, lui, est toujours lu.
+11
View File
@@ -94,6 +94,17 @@ compdef _repo repo
# Reglages propres a cette machine (non versionnes).
[ -f "$HOME/.zshrc.local" ] && source "$HOME/.zshrc.local"
# SSH interactif hors tmux (et hors terminal VS Code Remote-SSH) : entrer dans tmux,
# session partagee "main" (rattachee si elle existe). Le shell lance dans tmux relit ce
# fichier et ouvre le menu dtach ci-dessous ; quitter tmux ferme la connexion (exec).
case $- in *i*)
if [ -n "${SSH_CONNECTION:-}" ] && [ -z "${TMUX:-}" ] \
&& [ "${TERM_PROGRAM:-}" != vscode ] && command -v tmux >/dev/null; then
exec tmux new-session -A -s main
fi
;;
esac
# Au demarrage d'un shell interactif, proposer de reprendre une session dtach existante
# (silencieux si aucune).
case $- in *i*) [ -x "$HOME/.local/bin/dtach-router" ] && . "$HOME/.local/bin/dtach-router" ;; esac