Start or join tmux session when SSHing into server

Bo Jeanes 2020-10-24 18:30:14 +11:00
parent b6ed73162c
commit 385ff29089
2 changed files with 4 additions and 2 deletions

View File

@ -54,6 +54,7 @@ fresh-options --file=~/.zshrc --marker
fresh shells/zsh/p10k-instant-prompt.zsh
fresh shells/path.sh
fresh shells/tmux.sh
fresh freshshell/fresh contrib/source-build.sh
@ -73,6 +74,7 @@ fresh-options
fresh-options --file=~/.bashrc --marker
fresh shells/path.sh
fresh shells/tmux.sh
fresh shells/common/\*.sh
fresh shells/bash/\*.bash
fresh shells/bash/lib/\*.bash

View File

@ -6,11 +6,11 @@
# windows but be looking at different ones individually
# If we aren't in Tmux or emacs, set it up
if false && [ -z "$TMUX" -a -z "$INSIDE_EMACS" -a -z "$EMACS" ]; then
if command -v tmux &>/dev/null && [ "$SSH_CONNECTION" -a -z "$TMUX" -a -z "$INSIDE_EMACS" -a -z "$EMACS" -a -z "$VIM" -a -z "$VIMRUNTIME" ]; then
if tty >/dev/null; then
if which tmux 2>&1 >/dev/null; then
if [ -z "$(tmux ls | grep 'login:')" ]; then
tmux new-session -d -s login # Create a detached session called login
tmux new-session -d -s login $SHELL # Create a detached session called login
tmux new-session -t login # Create a *new* session bound to the same windows
else
last_session="$(tmux list-windows -t login | tail -n1 | cut -d: -f1)"