Skip to content

Instantly share code, notes, and snippets.

@ongyx
Last active October 26, 2021 07:20
Show Gist options
  • Save ongyx/bc5d4b7b39027a527c3ae90d3a72d167 to your computer and use it in GitHub Desktop.
Save ongyx/bc5d4b7b39027a527c3ae90d3a72d167 to your computer and use it in GitHub Desktop.
[WSL2] Start a new bash shell that can run graphical apps (using VcXsrv or another X server). Your original shell will be restored when you exit xshell (script is isolated)
export DISPLAY=$(ip route | awk '/^default/{print $3; exit}'):0
export LIBGL_ALWAYS_INDIRECT=1
export GDK_DPI_SCALE=1.25
export QT_SCALE_FACTOR=1.25
log=/dev/null
/mnt/c/Program\ Files/VcXsrv/vcxsrv.exe -multiwindow -ac -wgl -dpi auto &> $log &
bash
/mnt/c/Windows/System32/taskkill.exe /F /IM vcxsrv.exe /T &> $log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment