How can I check if a screen variant is active without knowing its name?

Use the notation

if not Q[screenvariant=]

...

endif

Please observe that, for GuiXT, the existence of a screen variant means:
screen variant + GuiXT script stored in the variant. Variants without GuiXT script are not detected by GuiXT.