I want some flatpak apps to run on my discrete Nvidia GPU by default. I can always right-click on the app and launch via discrete graphics but that's tedious.
I followed these steps but it did not work.
To force a Flatpak application to use discrete graphics by default on a system with dual graphics (integrated and discrete), you can follow these steps:
Determine the application ID: Open a terminal and run the following command to list all installed Flatpak applications along with their IDs:
flatpak list
Find the application for which you want to set the default GPU and note down its application ID.
Create a new configuration file: In the terminal, run the following command to create a new configuration file for the application:
sudo nano /etc/environment.d/flatpak.conf
This command will open a text editor (nano) to edit the configuration file.
Add environment variable: In the nano text editor, add the following line to the configuration file, replacing with the application ID you noted down in Step 1:
__NV_PRIME_RENDER_OFFLOAD=<app-id>
Save and exit: Press Ctrl + X to exit nano. When prompted to save the changes, type Y and then press Enter to confirm and save the file.
Reboot the system: Restart your computer to apply the changes.
After following these steps, the specified Flatpak application should use the discrete graphics by default when launched.