Automatically switch gpu graphics driver when gaming
I don't think you can do it automatically, but here is a work around I thought of.
First open a text editor like gedit
and paste this in to a new file
[Desktop Entry]
Name=Steam
Comment=Steam with Nvidia
Exec=sudo prime-select nvidia && steam
Icon=/usr/share/app-install/icons/steam.png
Terminal=false
Type=Application
Categories=Utility;Application;
Now save this as steam.desktop
to your /home
and make it executable
chmod +x ~/steam.desktop
Now drag the file to the launcher to replace the existing Steam icon and when you run Steam from this it should also switch to the Nvidia GPU.
The quickest way to switch back would be to use this command
sudo prime-select intel
You could create another desktop file to run the command from but if you run it once it will be accessible from the terminals history, by the up arrow key.
Please note I don't have a multi GPU laptop, so I can't test this, so please do give any feedback.