Skip to content

Instantly share code, notes, and snippets.

@DanEdens
Created September 7, 2021 14:29
Show Gist options
  • Save DanEdens/820a33d1af7ae58808e9b634bf6fff23 to your computer and use it in GitHub Desktop.
Save DanEdens/820a33d1af7ae58808e9b634bf6fff23 to your computer and use it in GitHub Desktop.
check_wsl2_otherwise_get_mqtt-stored_DISPLAY
if grep -qEi "(Microsoft|WSL)" /proc/version &> /dev/null ; then
echo WSL2 detected. Using Local \$DISPLAY. $DISPLAY
export DISPLAY=$(grep -m 1 nameserver /etc/resolv.conf | awk '{print $2}'):0.0
else
echo Using Ghost\'s \$DISPLAY: $DISPLAY
export DISPLAY=$(mosquitto_sub -h $AWSIP -p $AWSPORT -t status/ghost/IP -C 1):0.0
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment