gpu – How to temporarily set additional system environment variable only in ‘play’ mode inside godot editor?

I’m learning godot with a laptop that has AMD discrete GPU. My OS is Arch Linux so if I want to use discrete GPU I have to set system environment variable DRI_PRIME=1 temporarily. This can be easily done with pygame, just add following code:

import os

os.environ['DRI_PRIME'] = '1'

The game will launch using discrete GPU.

But if I want to do that in godot, I have to run it fully in discrete GPU, which means I have to use command DRI_PRIME=1 godot to launch it. It’s now using discrete GPU to run game, but it takes 4-5 seconds to react to my input when I switch back from tutorial webpage from browser. That’s because the discrete GPU will hang when switching out of godot, and I have to wait for it to respond. It will waste a lot of time if I frequently switch between godot and browser.

Is there any configuration to temporarily set system environment variable only in ‘play’ mode inside godot editor?