function gdbt -d "GDB with tmux panes"
    if set -q TMUX
        set proc (ps -ef | fzf | awk '{print $2}')

        if test -n "$proc"
            set -l tty1_id (tmux split-pane -hPF "#D" "tail -f /dev/null")
            tmux last-pane
            set -l tty1 (tmux display-message -p -t "$tty1_id" '#{pane_tty}')

            set -l tty2_id (tmux split-pane -hPF "#D" "tail -f /dev/null")
            tmux last-pane
            set -l tty2 (tmux display-message -p -t "$tty2_id" '#{pane_tty}')

            tmux select-layout even-horizontal

            gdb -q -ex "dashboard breakpoints -output $tty1" -ex "dashboard variables -output $tty1" -ex "dashboard threads -output $tty2" -ex "attach $proc"

            tmux kill-pane -t $tty1_id
            tmux kill-pane -t $tty2_id
        end
    else
        echo "Not inside TMUX"
    end
end
