Created
August 10, 2021 12:36
-
-
Save jeromescuggs/7c08300f4adc588287f879b853803254 to your computer and use it in GitHub Desktop.
zshrc: detect WSL environment and configure X on windows
This file contains 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
# 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