Linux Install Tweaks: xorg.conf

My desktop system has accreted a bunch of input devices over the years and the automagic X configuration system just doesn’t handle everything. Hence, some manual fiddling is in order every time I set up a new Linux installation.

Recall that I’m using Xubuntu because KDE4 Just Doesn’t Work with dual monitors.

Portrait-mode Monitor

You must use the nVidia restricted driver, so install that if you didn’t pick it during installation. I have no experience with ATI, other than reading many despairing posts saying ATI boards contribute great suckage to the Overall Linux Experience.

Use the Nvidia X Server Settings program to set up separate X sessions on each monitor. This is different from TwinView and Xinerama, which spread a single desktop over both screens, because it lets you independently switch between desktops on each screen. I want to edit my columns on the right-hand portrait screen while switching between PDF doc, simulations, schematics, and ahem email on the left screen, so separate X sessions are the way to go.

I save successive xorg.conf files in a directory in my home directory, then manually copy them into /etc/X11 as needed. That way, if (when!) an update clobbers the X setup, I can recover easily.

Save the file, copy it to /etc/X11/xorg.conf, log out, restart the X server (Ctrl-Alt-Backspace at the login screen will suffice), log back in again, make sure you have two monitor and separate X sessions, both in landscape mode. If not, fiddle around until you do.

Edit that xorg.conf file and add one line to the right-hand monitor’s Section “Screen”

Section "Screen"
    Identifier     "Screen1"
    Device         "Device1"
    Monitor        "Monitor1"
    DefaultDepth    24
    Option         "TwinView" "0"
    Option         "metamodes" "DFP-1: nvidia-auto-select +0+0"
    Option	        "Rotate" "CCW"
    SubSection     "Display"
        Depth       24

Hardcoded rotation disables RandR, which seems to not matter, although it does prevent the XFCE Display config applet from starting. I tried RandR some time ago and it basically didn’t work on the setup I had, so I gave up. As I never change screen resolutions or rotations on the fly, it doesn’t solve a problem I have, anyway.

Update: it seems the “nvidia-auto-select +0+0” setting causes an occasional hang when logging out; I must ssh in and reboot the system. Replace that string in both Screen sections with the actual resolution: 1600×1200 and 1680×1050, respectively, leaving the DFP-? in place.

Save the new xorg.conf, copy it, log out, restart X, and log back in again. Now the right-hand monitor runs in portrait mode: wonderful for editing pages of text. Stand the right-hand monitor on its left ear.

Wacom Tablet

I have a Wacom Graphire tablet, which sort of worked with the default xorg.conf, but the mouse pointer switched to the right-hand screen in the middle of the left screen. I think the default single-X configuration confused it mightily.

These sections pin it to the left-hand screen, let it rove over the full screen, and swap the side-switch buttons on the stylus. Tweak these sections and save copies as needed

Section "InputDevice"
        Identifier      "stylus"
        Driver          "wacom"
        Option          "Device" "/dev/input/wacom"
        Option          "Type" "stylus"
        Option          "Mode" "Absolute"
        Option          "ScreenNo" "0"
        Option          "Button2" "3"
        Option          "Button3" "2"

Section "InputDevice"
        Identifier      "eraser"
        Driver          "wacom"
        Option          "Device" "/dev/input/wacom"
        Option          "Type" "eraser"
        Option          "Mode" "Absolute"
        Option          "ScreenNo" "0"

Section "InputDevice"
        Identifier      "cursor"
        Driver          "wacom"
        Option          "Device" "/dev/input/wacom"
        Option          "Type" "cursor"
        Option          "Mode" "Absolute"
        Option          "ScreenNo" "0"


I have two trackballs, one on each side of the keyboard, to distribute the strain equally on both wrists. The default configuration treated them both as mice and didn’t allow separate configuration. That meant the left-hand ball operated in right-hand mode; a bit of a problem.

Fortunately, evdev now allows button configuration, so the setup was straightforward. Add these two sections

Section "InputDevice"
        Identifier      "LogiBall"
        Driver          "evdev"
        Option          "Device" "/dev/input/by-id/usb-Logitech_USB_Receiver-event-mouse"
        Option          "Emulate3Buttons" "false"
        Option          "Buttons" "10"

Section "InputDevice"
        Identifier      "KenBall"
	Driver		"evdev"
        Option          "Device" "/dev/input/by-id/usb-Kensington_Kensington_Expert_Mouse-event-mouse"
        Option          "Emulate3Buttons" "false"
        Option          "ZAxisMapping" "4 5"
        Option          "ButtonMapping" "3 2 1"       # Left hand

The default mouse configuration now doesn’t do anything, so remove the automagically generated Section “InputDevice” for Mouse0.


With all that in place, the Section “ServerLayout” entry becomes

Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0" 0 0
    Screen      1  "Screen1" RightOf "Screen0"
    InputDevice    "Keyboard0" "CoreKeyboard"
#   InputDevice    "Mouse0" "CorePointer"
    InputDevice     "LogiBall" "CorePointer"
    InputDevice     "KenBall" "SendCoreEvents"
    InputDevice     "stylus" "SendCoreEvents"
    InputDevice     "cursor" "SendCoreEvents"
    InputDevice     "eraser" "SendCoreEvents"

Save it, copy it, log out, restart the X server, log back in again, and enjoy …

Although your setup will differ from mine, here’s the entire xorg.conf file for your perusal and my backup. It’s saved as an OpenOffice odt document: just open it and Save As plain old text and it’ll work fine. There’s a bit more cruft than I mentioned, but that’s how it goes…

This doesn’t resolve the random USB disconnects and X hassles I described there, but now that I’m not wearing an acrylic overshirt it’s not so much of a problem.