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
This works in ubuntu if you want to set any other screen mode get the according screen line with cvt XRES YRES FREQUENCY
Also the device name may have to be modified but VGA1 is typical for an second monitor which is plugged in via VGA.