Rakim's Blog

how to avoid running tmux in vscode-terminal

If you're like me and have a default attach-session setup in your ~/.zshrc and but don't want VSCode to attach to it, then this is for you.

Just check if the name of parent process != 'code'

# check if parent is foot, then start 
tmux_run() {
  parent_process=$(ps -p $PPID -o comm=)
    if [[ "$parent_process" != "code" ]]; then
        if [ -z "$TMUX" ]; then
            tmux attach-session -t envy || tmux new -s envy
        fi
}
tmux_run

#tmux #zsh