0

Following one of the comments of one of the responses to this question I've set my default shell to /usr/bin/tmux, which works perfectly fine.

But now I'd like if I could assign all logins to one account to be attached to the same window-group. As per this gist that works by adding new-session -s main to ~/.tmux.conf and then invoking tmux as tmux new-session -t main

Is there a way to have this be invoked as the login shell, or have tmux itself attach to the "main" window-group on launch by default?

3
  • I find it easier to run a normal shell and use .bashrc or .zshrc to create a new session or attach to an existing one - YMMV
    – Panki
    Jun 29, 2020 at 12:40
  • And how do I do that?
    – toman
    Jun 29, 2020 at 14:06
  • Second answer in the question you linked.
    – Panki
    Jun 29, 2020 at 14:41

1 Answer 1

0
if command -v tmux &> /dev/null && [ -n "$PS1" ] && [[ ! "$TERM" =~ screen ]] && [[ ! "$TERM" =~ tmux ]] && [ -z "$TMUX" ]; then
   exec /usr/bin/tmux new-session -t main
fi

Added to the end of my .bashrc seems to do this as I wanted.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .