I’d like to set an environment variable, for every users, when running Gnome under Wayland. The variable should not be set when running Gnome under X11. For concreteness, say I want to set the variable QT_QPA_PLATFORM to the value wayland when running Wayland.
I tried putting QT_QPA_PLATFORM=wayland in /usr/share/gdm/env.d/wayland-env (following the doc mentioned here) (hoping this would have an effect only under Wayland) but this seems to have no effect, even under Wayland: after rebooting, logging under Gnome / Wayland, opening a terminal: echo $QT_QPA_PLATFORM yields nothing.
I use a freshly installed Debian Bullseye.