Switching between integrated and dedicated GPUs on a Linux desktop
The best way to do is on modern Linux desktop is not through physical HDMI switches, but through prime render offloading combined with PCI-express runtime power Management (RTD3) .
This means instead physically activating and deactivating the card, you just plug in your monitor directly into the motherboard to use the IGPU . The OS and desktop environment run fully on the iGPU. The dGPU sits on PCIE bus suspended in a very, very low power state and will only turn on when you launch any that would need dGPU. This how me and buddy did it for his desktop two years ago but thing change, so this might not easy way anymore but it was I did it
The below is just from a quick google search, I couldn’t find anything for intel GPUs tho sorry
How to Switch GPUs Inside Linux (The Simple Way)
For AMD dGPUs (Simplest Setup):AMD’s open-source amdgpu driver handles runtime power management automatically on modern kernels.To launch a program on the dGPU, prepend the command in your terminal or application shortcut with DRI_PRIME=1. Example: DRI_PRIME=1 blenderFor Steam games, right-click the game > Properties > Launch Options and add: DRI_PRIME=1 %command%.
For NVIDIA dGPUs (Requires Configuration):You must explicitly enable dynamic power management for the proprietary driver. Crucially, desktop D3cold power management requires an RTX 20-series (Turing architecture) or newer GPU.You must create a configuration file (e.g., /etc/modprobe.d/nvidia-power-management.conf) containing: options nvidia NVreg_DynamicPowerManagement=0x02. To launch a program, use the prime-run wrapper script, or set the variables manually: __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia blender.
hopefully this helps or someone else knows a better way