- download, compile and install socat 1.7.4.x (http://www.dest-unreach.org/socat/)
- append startXonVsock to ~/.bashrc or put it in ~/.bashrc.d
- after login in WSL2, run startX.(cmd|ps1) in Windows to start the VcXserv
- run X session in WSL2 (e.g. MATE:
mate-session > /dev/null 2>&1
) - happy clicking :)
Last active
January 18, 2022 21:15
-
-
Save indika-dev/4f019a9e14624bbb61fea816a4d833d6 to your computer and use it in GitHub Desktop.
start VcXserv on a VSOCK connection. Tested with VcXserv 1.20.14.0 and Ubuntu 20.04 WSL2. On Windows, you must be local admin.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ECHO Off | |
SETLOCAL | |
gsudo hcsdiag list > temp.txt | |
set /p str=<temp.txt | |
:: only needed, if you want to check the value | |
:: ECHO %str% | |
:: this works only, because the GUID is the first line in temp.txt! | |
gsudo C:\Programme\VcXsrv\vcxsrv.exe :0 -vmid {%str%} -vsockport 106000 -ac -wgl +xinerama |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this should work... I can't test it, because only signed powershell-scripts are allowed | |
$vmid = gsudo hcsdiag list | Select-String -Pattern '(?im)^[{(]?[0-9A-F]{8}[-]?(?:[0-9A-F]{4}[-]?){3}[0-9A-F]{12}[)}]?$' | |
$vmid = $vmid -replace "`n","" | |
gsudo C:\Program Files\VcXsrv\vcxsrv.exe ':0' -vmid '{'+$vm+'}' -vsockport 106000 -ac -wgl +xinerama |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
if [[ -z $(pidof -s socat) ]]; then | |
if [[ -S /tmp/.X11-unix/X0 ]]; then | |
rm /tmp/.X11-unix/X0 | |
fi | |
sudo socat -b65536 UNIX-LISTEN:/tmp/.X11-unix/X0,fork,mode=777 vsock-connect:2:106000 >/dev/null 2>&1 & | |
fi | |
export DISPLAY=:0 | |
export LIBGL_ALWAYS_INDIRECT=1 | |
# export XDG_CURRENT_DESKTOP=ubuntu:mate | |
# export PULSE_SERVER=tcp:$(cat /etc/resolv.conf | grep nameserver | awk '{print $2; exit;}') #GWSL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment