How I can make tmux not create a infinite loop of "tmuxes"?

88 Views Asked by At

So, I'm using Xonsh Shell and tmux, where on ~/.xonshrc, the contents are this:

# XONSH WEBCONFIG START
$XONSH_COLOR_STYLE = 'rainbow_dash'
# XONSH WEBCONFIG END
$XONSH_SHOW_TRACEBACK = True
$all_proxy="socks5://localhost:9050"
$UPDATE_OS_ENVIRON = True
tmux
xdotool key ctrl+b c
xdotool key ctrl+b 0
xdotool type "weechat"

Is there a way I can make tmux NOT start any more instances of itself?

I tried to unset TMUX enviroment variable, hoping that this would not happen anymore, but it just created more instances this way.

1

There are 1 best solutions below

0
pynexj On BEST ANSWER

I guess this is how the infinite loop happens —

  1. You start xonsh
  2. xonsh loads .xonshrc
  3. .xonshrc starts tmux or create new tmux windows
  4. In new tmux windows, tmux starts new xonsh
  5. Go to step 2.

You can try like this:

if not !(tmux ls):
    tmux new -d
    tmux new-window
    tmux send -t :0 weechat enter
    tmux attach -t :0