Making stamina/speed switch work in Linux

I have a Sony Vaio notebook, in particular a VGN-SZ61MN/B. One of its nice features is that is has two graphic devices for you to choose before booting. The Intel graphics device is useful to save battery power, e.g. in long train rides, whereas the Nvidia one makes sense for more graphics intense applications. The notebook has a switch labeled “stamina” and “speed”, respectively.

As one might expect, this kind of switching does not work in Linux out of the box. However, it is not very difficult to get it to work. After having done this several times, I got lazy and put all the necessary steps into a little bash-script:

Stamina_Speed_Switch_Sony_Vaio (1392)

It is meant to work with Ubuntu (and with very minor modifications it should also work with Debian). My experience tells me to do the installation using the Intel GPU, and then afterwards you can boot with the Nvidia card enabled. Next, install the Nvidia drivers, and then run my script. If you have any special things you want to put in your xorg.conf files, you can simply edit the script to include that. After that, it should all be fine.

Note that I have tested this only on my notebook and that I do not guarantee that it works equally well for you and your notebook. I hope it is useful for others as well. Let me know about your experiences or improvements with it.

Update: the script from the above link apparently only works for jaunty. Some things changed in karmic, try this slightly modified script for Ubuntu 9.10:

Stamina_Speed_Switch_Sony_Vaio (1170)

Update 2: Here is an updated version for lucid. I had to get used to the upstart stuff but it seems to be working now for Ubuntu 10.04:

Stamina_Speed_Switch_Sony_Vaio_lucid (1433)