2

I'm using zsh and byobu (using the tmux backend).

In my .zshrc file I put the following:

if which byobu >/dev/null 2>&1; then                                        
    # if not inside a byobu session, and if no session is started,
    # start a new session
    test -z "$TMUX" && (byobu attach || byobu new-session)
fi

If I close the terminal emulator I'm using, then open another one, I re-attach to the byobu session I was using and all is fine. However, when I just start my computer, or if I exited byobu (for example by pressing Ctrl-D on the last open window), opening a new terminal results in this:

[exited]
~$ 

It seems to be because byobu attach actually returns something, so byobu new-session is never run, but I don't understand why byobu attach finds something if I quit byobu (in this case, $TMUX is empty).

How can I make sure that a new session of byobu is launched if there is no instance already running?

Thanks!

Pierre
  • 402
  • 3
  • 13
  • `https://www.byobu.org/` is the new URL. The old one is a squatting, scam, or otherwise meaningless blog site now. `byobu-select-session` might help, although that seems to disable my hotkeys.. – Pysis May 18 '22 at 16:01

0 Answers0