mirror of https://github.com/bjeanes/dotfiles.git
Refactor tmux shell behavior
parent
a94435f221
commit
3e1d54f454
|
@ -3,20 +3,7 @@ COMMON_SHELL_FILES="$SHELL_FILES/../common"
|
|||
# TODO: Remove duplicates from the PATH
|
||||
PATH="/usr/local/bin:/usr/local/sbin:/usr/X11/bin:/usr/bin:/usr/sbin:/bin:/sbin:${PATH}"
|
||||
|
||||
if [ -z "$TMUX" ]; 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 -t login # Create a *new* session bound to the same windows
|
||||
else
|
||||
last_session="$(tmux list-windows -t login | tail -n1 | cut -d: -f1)"
|
||||
tmux new-session -t login \; new-window -a -t $last_session # Create a *new* session bound to "login" and create a new window
|
||||
fi
|
||||
fi
|
||||
|
||||
exit
|
||||
fi
|
||||
|
||||
source "$SHELL_FILES/../tmux.sh"
|
||||
|
||||
CDPATH=".:${HOME}"
|
||||
if [ -d "$HOME/Code" ]; then
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
# I always want to be in a Tmux session. Always.
|
||||
#
|
||||
# This creates a single always-running "login" session, and creates
|
||||
# new session as needed that are bound to "login"'s window group.
|
||||
# This lets me have a different terminals tabs/windows have the same tmux
|
||||
# windows but be looking at different ones individually
|
||||
|
||||
# If we aren't in Tmux, set it up
|
||||
if [ -z "$TMUX" ]; 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 -t login # Create a *new* session bound to the same windows
|
||||
else
|
||||
last_session="$(tmux list-windows -t login | tail -n1 | cut -d: -f1)"
|
||||
tmux new-session -t login \; new-window -a -t $last_session # Create a *new* session bound to "login" and create a new window
|
||||
fi
|
||||
fi
|
||||
|
||||
# When Tmux exits, we exit
|
||||
exit
|
||||
fi
|
Loading…
Reference in New Issue