# Linux Lite — NVIDIA 470 + GTK4 NGL repaint workaround (sourced by Xsession).
#
# GTK 4.14 (Ubuntu 24.04 / Series 7) defaults to the NGL/Vulkan renderer, which
# the NVIDIA 470 legacy driver mis-handles: GTK4 windows render blank or fail to
# repaint (e.g. Lite Updates shows a blank white window). Forcing GTK4's older GL
# renderer fixes it. Applied ONLY while the 470 kernel module is the one actually
# loaded, so any other driver/GPU keeps GTK4's default renderer. Re-evaluated at
# every login, so it self-corrects automatically if the driver later changes.
# Ref: NVIDIA Developer Forums — GT 730 / v470 / Ubuntu 24.04 repaint bug.

if [ -r /proc/driver/nvidia/version ] && \
   grep -Eq 'NVRM version:.* 470\.[0-9]' /proc/driver/nvidia/version 2>/dev/null
then
    GSK_RENDERER=gl
    export GSK_RENDERER
fi
