Generally I use bumblebee - it’s better solution for me than logging out every time when I want to use nvidia card. But sometimes I need to use nvidia prime because of some issues in bumblebee.
If you want to use nvidia-prime and you still want to have bumblebee installed on your system, look at this script. You probably need to modify some lines because I wrote it only for my own needs. But it shows steps which must be done to make it work.
It’s written for Ubuntu. If you have Debian you need to change glx alternatives. I don’t know what about other systems.
I know you posted this a little while ago but it came up during my research to switch easily between bumblebee and prime.
As I was modifying your script I thought “might as well make is as agnostic as possible”, put in some automation and what not and uploaded the results.
If you wanna email me your email and I’ll give you proper credit on the script (or if you put yours on github, ill take mine down and make it a fork of yours or something).
So again, thanks for this.
Mine might need some work to make it work on a gnome environment, since i run xfce4 I cant really test.
Ah awesome, yeah I added in auto module name stuff but use dpkg -l to find it (so it does rule out people who’ve installed manually, hhmmm) , I found the best way for home dir is “logname”;
Problem is that you can execute is as root using “su” command. In this case $HOME variable is overwritten by path to root home dir. You can assume that only one user is logged in or read which one user has auto-logging enabled in lightdm config files (which AFAIK is needed for nvidia-prime). Or you can just assume that using “sudo” instead of “su” is necessary :)