# This file is sourced by Xsession(5), not executed.
# If the hardware does not pass unity_support_test, fall back to LLVMpipe
# which does.

if [ "x$DESKTOP_SESSION" = "xubuntu" ] && [ -x "/usr/lib/nux/unity_support_test" ]; then
    (
        IFS=':'
        for d in $XDG_CURRENT_DESKTOP; do
            if [ "x$d" = "xUnity" ] || [ "x$d" = "xUnity7" ]; then
                return 0
            fi
        done
        return 1
    )

    if [ $? = 0 ]; then
        /usr/lib/nux/unity_support_test || export LIBGL_ALWAYS_SOFTWARE=1
    fi
fi
