How to write an xorg.conf file for linux

For those who don't know what an 'xorg.conf' file is, it's basically the file in Linux operating systems that tells the system what graphics card, mouse, keyboard you have, and what settings to use for them. There are a few GUIs for making these, but most of them do a terrible job, and add bloat.
My xorg.conf is clean, and therefore, easy to modify/change.

I've used the same xorg.conf for a long time, across 4 different machines (with very minor modifications depending on resolution required etc..)

It'll save a lot of time to just write it once, and reuse it. All I do is install the nvidia driver and copy over my xorg.conf and reboot, and you have a perfect working system.
This file should work for any nVidia graphics card (the names of my monitor and model of graphics card are just labels and don't matter) and will work with just the minor changes mentioned below.

If you have a laptop with nVidia graphics, and would like a perfectly configured xorg.conf for linux, you might want to just cheat and use my custom xorg.conf

Key features:

trackpad with vertical scrolling enabled.
USB connected mice will have forward and back buttons enabled in firefox.
nVidia logo at logon is removed.
Refresh rate is correctly reported as 60Hz instead of 50Hz with
Option "DynamicTwinView" "FALSE"
All required modules for Compiz Fusion to work. (no more borderless windows!)
DPMS adds Energy Star power saving functions for your monitor.
You can use any of the following (put in ServerLayout)

Option "StandbyTime" "10"
Option "SuspendTime" "20"
Option "OffTime" "30"
You'll just have to change your desired resolution and refresh rate (1280x800_60 in mine)

Also, note, if you're using a desktop with multiple DVI ports, you'll need to specify (DPF for Digital Flat Panel) under Screen

Option "metamodes" "DFP-1: nvidia-auto-select +0+0"

Anyway, here's my xorg)


# Xorg SyXbiT - Dell XPS m1330 w/ nVidia GeForce 8400M GS

Section "ServerLayout"
Identifier "Default Layout"
Screen 0 "Screen0" 0 0
InputDevice "Keyboard0"
InputDevice "Mouse0"
InputDevice "Touchpad"
Option "OffTime" "30"

EndSection

Section "Files"
EndSection

Section "Module"
Load "dbe"
Load "extmod"
Load "type1"
Load "freetype"
Load "glx"
EndSection

Section "ServerFlags"
Option "Xinerama" "0"
EndSection

Section "InputDevice"
Identifier "Keyboard0"
Driver "kbd"
Option "CoreKeyboard"
Option "XkbRules" "xorg"
Option "XkbModel" "pc105"
Option "XkbLayout" "us"
EndSection

Section "InputDevice"
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/psaux"
Option "Emulate3Buttons" "no"
Option "Buttons" "7"
Option "ButtonMapping" "1 2 3 6 7"
Option "ZAxisMapping" "4 5"
Option "EmulateWheel" "true"
Option "EmulateWheelButton" "2"
Option "SHMConfig" "on"
EndSection


Section "InputDevice"
Identifier "Touchpad"
Driver "synaptics"
Option "SendCoreEvents" "true"
Option "Device" "/dev/psaux"
Option "Protocol" "auto-dev"
Option "HorizEdgeScroll" "0"
EndSection

Section "Monitor"
Identifier "Monitor0"
VendorName "Dell"
ModelName "CMO LED"
HorizSync 30.0 - 75.0
VertRefresh 60.0
#DPMS for Energy Star power saving
Option "DPMS" "TRUE"
#Fix refresh rate bug
Option "DynamicTwinView" "FALSE"
EndSection

Section "Device"
Identifier "8400M GS"
Driver "nvidia"
Option "NoLogo" "true"
VendorName "NVIDIA Corporation"
BoardName "GeForce 8400M GS"
Option "DPMS"
EndSection

Section "Screen"
Identifier "Screen0"
Device "8400M GS"
Monitor "Monitor0"
DefaultDepth 24
Option "TwinView" "0"
Option "metamodes" "1280x800_60 +0+0"
EndSection

Digg this

6 comments:

  1. Anonymous said,

    I had previously copied your Xorg, and it worked great, but I've since changed to OpenSuse. I really liked the cursor theme that yours used. Do you remember what the name is?

    on 7/4/08 01:28


  2. SyXbiT said,

    AFAIK the cursor theme has nothing to do with your xorg file.
    it's done once logged in, and in the display preferences

    on 7/4/08 14:10


  3. Anonymous said,

    Fixed it, thanks anyways.

    on 7/4/08 15:05


  4. Jerome said,

    Upgraded to Heron yesterday and lost proper definition (now in 800 by 600!).
    I have a nVidia Corporation GeForce 8400M GS (rev a1) and using the restricted driver proposed by Heron. Any idea ?

    on 28/4/08 10:14


  5. SyXbiT said,

    you could just copy my xorg.conf
    it's for the same graphics card.
    just switch out my 1280x800 for the resolution you want.
    if not, i'd probably recommend a fresh install. I've never trusted those upgrades much

    on 28/4/08 10:22


  6. Anonymous said,

    Thank you syxbit. A fresh install solved the problem. I am back to a good resolution although without using the nvidia driver (which crashes the display). This seem to be filed as a known bug: https://bugs.launchpad.net/ubuntu/+source/xorg/+bug/173418
    J.

    on 29/4/08 03:16