How to switch primary gpu for wayland

To utilize a dedicated GPU for specific applications, you can set environment variables as follows:

 __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia __VK_LAYER_NV_optimus=NVIDIA_only glxinfo | egrep "OpenGL vendor|OpenGL renderer"

To force your laptop to exclusively use the dedicated GPU, you can follow the method described in this post: Fedora 36: Nvidia as Primary GPU.

I’ve tried this out on KDE, and it worked fine for me. However, I haven’t given it a go on GNOME yet.