Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
zshrc: detect WSL environment and configure X on windows
# WSL1 compatibility with X server (x410, others should work)
if [[ "$(</proc/version)" == *Microsoft* ]] 2>/dev/null; then
export WSL=1
export DISPLAY=localhost:0
export NO_AT_BRIDGE=1
export LIBGL_ALWAYS_INDIRECT=1
# sudo /usr/local/bin/clean-tmp-su
# else
# export WSL=0
fi
# WSL2 compatibility
if [[ "$(</proc/version)" == *microsoft* ]] 2>/dev/null; then
export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2; exit;}'):0.0
export LIBGL_ALWAYS_INDIRECT
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment