Tmux on login

to start tmux on login add the following to your ~/.bashrc

# Start Tmux by default
# If not running interactively, do not do anything
if command -v tmux>/dev/null; then
  [[ ! $TERM =~ screen ]] && [ -z $TMUX ] && exec tmux
fi

Auto attach

to automatically attach to last session or create a new if none available extend your ~/.bashrc and ~/.tmux.conf with the following

~/.bashrc

# Start Tmux by default
# If not running interactively, do not do anything
if command -v tmux>/dev/null; then
  [[ ! $TERM =~ screen ]] && [ -z $TMUX ] && exec tmux attach
fi

~/.tmux.conf

# if run as "tmux attach", create a session if one does not already exist
new-session -n $HOST

Start with defaults

needs integration for automatic start

~/tmux-init

#!/bin/bash

# the name of your primary tmux session
SESSION=$USER

# if the session is already running, just attach to it.
tmux has-session -t $SESSION
if [ $? -eq 0 ]; then
	echo "Session $SESSION already exists. Attaching."
	sleep 1
	tmux -2 attach -t $SESSION
	exit 0;
fi

# create a new session, named $SESSION, and detach from it
tmux -2 new-session -d -s $SESSION -c /srv

#setup panes/windows
tmux move-window -t 11

tmux set -g mouse-resize-pane on
tmux set -g mouse-select-pane on
tmux set -g mouse-select-window on

tmux new-window -t 9 "htop"

tmux new-window -t 0 "nload -i 1000000 -o 1000000"
tmux split-window -l 10 "bwm-ng"

#tmux new-window -t 8 -n ncdc "su - iiidefix -c /home/iiidefix/ncdc"

tmux send-keys -t 11 "exit" C-m

tmux new-window

#tmux select-window -t 1

tmux attach