Skip to content

Instantly share code, notes, and snippets.

@y3nr1ng
Created October 23, 2021 22:43
Show Gist options
  • Save y3nr1ng/f63f11513e65f73b5f1275e4f5c09440 to your computer and use it in GitHub Desktop.
Save y3nr1ng/f63f11513e65f73b5f1275e4f5c09440 to your computer and use it in GitHub Desktop.
This is the emulated startx script for VcXsrv on WSL2, it will spawn the VcXsrv client and connect to it.
#!/usr/bin/env bash
# get host address
HOST=$(ip address show dev eth0 | awk -F '[ /]+' '/inet / { print $3 }')
# start the server
powershell.exe -Command '& "C:\Program Files\VcXsrv\vcxsrv.exe" -multiwindow -nowgl'
# configure xhost
WSLENV="$WSLENV:DISPLAY"
powershell.exe -Command '& "C:\Program Files\VcXsrv\xhost.exe" '+$HOST
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment