I am using the mpv media player to play my videos. I have a laptop with hybrid graphics so in order to use the discrete GPU I must use DRI_PRIME=1 mpv video.mp4
whenever I want to run mpv with the discrete GPU. However, typing DRI_PRIME=1
everytime is quite annoying, so I was wondering if there is a way to make it so everytime I run mpv DRI_PRIME=1
is always used.
2 Answers
If you want only mpv
to be affected, just alias it:
alias mpv='DRI_PRIME=1 mpv'
You can add this to ~/.bashrc
or ~/.bash_aliases
.
Place that variable into your ~/.bashrc
file like so:
export DRI_PRIME=1
and run source ~/.bashrc
. After that this variable will be always in your shell's environment.
NOTE: exporting variables allows them to be passed to each and every program you run from shell. For the most part this should not matter, unless you have two programs that expect different value for your variable ( in this case DRI_PRIME
). If you intentionally want two programs have different value of DRI_PRIME
, use muru's answer.
-
1
-
maybe add a note that every program run from the command line will use the discrete card which may or may not be what you want– catJun 7, 2017 at 17:25
-