Tools: Add tmux support to run_in_terminal_window.sh

Added in an option so that if running SITL in a tmux session it will open a new window in tmux.
More or less an alternate option to screen.
It will detect if its running in a tmux session by checking the $TMUX and $TERM env variables.
I put it before other options because when I am running a tmux session even in a GUI environment
I would prefer a new Tmux window compared to a new terminal.
This will only run if youre already in a tmux session it will not launch a new session.
This commit is contained in:
Braedon O'Meara 2021-07-29 14:31:12 -05:00 committed by Peter Barker
parent 4f12c94346
commit de91058b1a
1 changed files with 2 additions and 0 deletions

View File

@ -28,6 +28,8 @@ if [ -n "$SITL_RITW_TERMINAL" ]; then
printf "%q " "$@" >>"$FILEPATH"
chmod +x "$FILEPATH"
$SITL_RITW_TERMINAL "$FILEPATH" &
elif [ "$TERM" = "screen" ] && [ -n "$TMUX" ]; then
tmux new-window -dn "$name" "$*"
elif [ -n "$DISPLAY" -a -n "$(which osascript)" ]; then
osascript -e 'tell application "Terminal" to do script "'"$* "'"'
elif [ -n "$DISPLAY" -a -n "$(which xterm)" ]; then