Apr 27, 2008

Dual Head and Compiz Fusion

Dual Head means Two screens. It's awesome.

I love Compiz Fusion, but I disabled it a while back since some things were a little slow, memory usage was high, etc. Then I got a new video card, which works rather well. Then I got a second monitor, got that working fairly easily (I'd post an article but I don't remember how I did it. I think I just went into nvidia-settings and turned it on). Now I tried to enable Compiz Fusion again and found that it did not work.

Now that I've taken my aspirin, I can tell you how to do it to spare you the headache that I now have. I'm assuming you're using an Nvidia card. This is a good assumption, since ATI cards really don't work with Linux. If you're trying out Linux on an ATI card, be warned for many problems ahead, and don't continue reading this article.

EDIT: Apparently since the time that I wrote this article, ATI (or I should say AMD) has fixed up their Linux drivers a fair bit. Since I don't have an ATI card, I can't really verify this.

Ok, so first things first. Back up your xorg.conf file:
sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.bak
In case of emergency, you can always resort back to your old xorg.conf file by doing this:
1) Press Ctrl+Alt+F1.
2) Log in as your normal user.
3) Type:
sudo cp /etc/X11/xorg.conf.bak /etc/X11/xorg.conf
4) Type:
sudo /etc/init.d/gdm restart

Start up Nvidia settings:
sudo nvidia-settings

Click the X Server Display Configuration to see your displays.
Here is what I have:

You should see your two screens appearing there as the light blue boxes. You can click the different ones to change which one you want to set up.

The first thing to do is use TwinView. While dual head works with Xinerama, Compiz Fusion does not. So click "Configure" and choose TwinView.

Pick a resolution for your screens depending on what your monitors support. For me, I have a wide screen and a non-widescreen so I use 1440x900 for one and 1280x960 for the other. You can pick what you like.

If your monitors are using two different resolutions (like mine) you might want to change how they are positioned with respect to one another. I like to have my taskbars at the same level (I put my taskbars at the bottom, something Windows has ingrained into me) so I set my position field to Absolute and then you can click and drag the monitors to be where you want. You can even position them on top of each other if you like, but I put them side-by-side. You can do this by selecting "Right of" or "Left of", but then it doesn't keep the bottoms flush, which I don't like. You can tinker around with this to get a resolution you like.

Unfortunately you probably won't get to see all the changes you made by clicking Apply, so click "Save to X Configuration File", say Yes to everything, and then log out. After you log back in again, you will have your new setup.

For me, I had the problem that one of the monitors didn't stay on, and the other one was at 320x240. This is pretty easily fixable. You'll have to open a terminal (Applications->Terminal) and type
sudo nvidia-settings
and go through this stuff again. Unfortunately you probably won't be able to see the whole window, so you can hold Alt and drag on the window in order to move it to where you want. Set your primary monitor to a good resolution and click Apply. Then do what you need to do.

Now, activate Compiz Fusion: System->Preferences->Appearance
Click the Visual Effects tab, and click Extra. Compiz Fusion should now turn on. Awesome! I suggest trying the cube feature (hold Ctrl and Alt, and click+drag the mouse on the desktop. It's neat.


shreg said...

"This is a good assumption, since ATI cards really don't work with Linux"

That's a big assumption, considering the very big progress made by ati with their proprietary driver and with their involvement in opensource driver.

One year ago I would have agreed but now I do not.

Rob Britton said...

Yep, I wrote this article about 6 months ago, about a year after I had a nightmare of a time trying (and failing) to get my ATI card to work.

Kryztoval said...

I have to say (being with ATI for quite a bit) that even to this date I keep being dissapointed. Somehow, the linux driver won't support more than 1920x1920 with compiz... and there is no easy way to disable compiz but keeping the driver running. Also, there is no graphical way to keep 2 cards running at the same time... you have to tweak a lot. I managed to do all these things, but it was not easy, not even the least.