Instead of export DISPLAY="localhost:0
, you can try these lines in your .bashrc (especially ff you have WSL2):
export DISPLAY=$(awk '/nameserver / {print $2; exit}' /etc/resolv.conf 2>/dev/null):0
export LIBGL_ALWAYS_INDIRECT=1
See also the thread here.