Skip to content

Instantly share code, notes, and snippets.

@jeromescuggs
Created August 10, 2021 12:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeromescuggs/7c08300f4adc588287f879b853803254 to your computer and use it in GitHub Desktop.
Save jeromescuggs/7c08300f4adc588287f879b853803254 to your computer and use it in GitHub Desktop.
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