How to automatically start tmux after login

tmux or screen are mandatory to use Wazaterm to keep the sessions because your browser sometimes stops the connection due to becoming standby or disconnecting wifi. But every time you type tmux attach is tiresome. To automatically start tmux after login, you can add the below lines into ~/.bashrc

if [[ -n "$PS1" ]] && [[ -z "$TMUX" ]] && [[ -n "$SSH_CONNECTION" ]]; then
 tmux attach-session -t work || tmux new-session -s work
fi