Previous Section  < Day Day Up >  Next Section

Recipe 15.8. Choosing Different ServerLayouts at Startup

15.8.1 Problem

You don't want to be locked into the same old thing every time you start X. Maybe you want Xinerama. Maybe you want Traditional. Maybe you want to run a single monitor on occasion, and you want to be able to select which one.

15.8.2 Solution

Configure different ServerLayouts in XF86Config, then select the one you want with startx options:

$ startx — -layout Single0

$ startx — -layout Single1

$ startx — -layout Clone

$ startx — -layout Traditional

This layout starts a single monitor:

Section "ServerLayout"

  Identifier    "Single0"

  InputDevice   "Default Keyboard0"    "CoreKeyboard"

  InputDevice   "Default Mouse0"       "CorePointer"

  Screen        "Screen0"

EndSection

Start this layout like this:

$ startx — -layout Single0

Now add a second Single layout, so that you can select either monitor at startup:

Section "ServerLayout"

  Identifier     "Single1"

  InputDevice    "Default Keyboard0"    "CoreKeyboard"

  InputDevice    "Default Mouse0"       "CorePointer"

  Screen         "Screen1"

EndSection

Start this layout like this:

$ startx — -layout Single1

You can also create ServerLayouts for each of your multihead modes. This example starts Clone mode:

Section "ServerLayout"

  Identifier   "Clone"

  InputDevice  "Default Keyboard0" "CoreKeyboard"

  InputDevice  "Default Mouse0" "CorePointer"

  Option       "Clone" "on"

  Option       "Xinerama"off"

#Other screen position options are Below, Above, and LeftOf

  Screen       "Screen0" RightOf "Screen1"

  Screen       "Screen1"

EndSection

This example starts Traditional mode:

Section "ServerLayout"

  Identifier   "Traditional"

  InputDevice  "Default Keyboard0" "CoreKeyboard"

  InputDevice  "Default Mouse0" "CorePointer"

  Option       "Clone" "off"

  Option       "Xinerama"off"

#Other screen position options are Below, Above, and LeftOf

  Screen       "Screen0" RightOf "Screen "

  Screen       "Screen1"

EndSection

Recipe Recipe 15.7 shows the Xinerama ServerLayout.

15.8.3 Discussion

Here is a sample XF86Config, showing all the required elements and two ServerLayouts.

The core elements are the Input Device, Device, and Monitor sections. These are the sections where your devices are identified and linked to their drivers. The Screen section sets resolution and color depth. In the ServerLayout sections, you put together the pieces for your various modes by their Identifiers.

Section "Files"

    FontPath      "unix/:7100"

    FontPath      "/usr/lib/X11/fonts/misc"

    FontPath      "/usr/lib/X11/fonts/cyrillic"

    FontPath      "/usr/lib/X11/fonts/75dpi"

EndSection

   

Section "ServerFlags"

  Option   "DefaultServerLayout"  "Xinerama"

EndSection

   

Section "Module"

    Load   "ddc"

    Load   "GLcore"

    Load   "dbe"

    Load   "dri"

    Load   "extmod"

    Load   "glx"

    Load   "record"

    Load   "bitmap"

    Load   "speedo"

EndSection

   

Section "InputDevice"

    Identifier    "Default Keyboard0"

    Driver        "keyboard"

    Option        "CoreKeyboard"

    Option"        XkbRules"          "xfree86"

    Option        "XkbModel"          "pc104"

    Option        "XkbLayout"         "us"

    EndSection

   

Section "InputDevice"

    Identifier     "Default Mouse0"

    Driver         "mouse"

    Option         "CorePointer"

    Option         "Device"             "/dev/input/mice"

    Option         "Protocol""IMPS/2"

    Option"         Emulate3Buttons"     "true"

    Option         "ZAxisMapping"        "4 5"

EndSection

   

Section "Device"

    Identifier  "3dfx"

    Driver      "tdfx"

    BusID       "PCI:1:0:0"

EndSection

   

Section "Device"

    Identifier  "nVidia"

    Driver      "nv"

    BusID       "PCI:0:12:0"

EndSection

   

Section "Monitor"

    VendorName           "0195"

    ModelName            "SYL"

    Identifier           "Monitor0"

    HorizSync             30-70

    VertRefresh           0-160

    Option               "DPMS"

EndSection

   

Section "Monitor"

    VendorName           "0195"

    ModelName            "SYL"

    Identifier           "Monitor1"

    HorizSync             30-70

    VertRefresh           0-160

    Option               "DPMS"

EndSection

   

Section "Screen"

    Identifier      "Screen0"

    Device          "3dfx"

    Monitor         "Monitor0"

    DefaultDepth     24

    SubSection "Display"

         Depth    24

         Modes   "1024x768"

    EndSubSection

EndSection

   

Section "Screen"

    Identifier      "Screen1"

    Device          "nVidia"

    Monitor         "Monitor1"

    DefaultDepth     24

    SubSection "Display"

         Depth    24

         Modes   "1024x768"

    EndSubSection

EndSection

   

Section "ServerLayout"

  Identifier     "Xinerama"

  InputDevice    "Default Keyboard0"      "CoreKeyboard"

  InputDevice    "Default Mouse0"         "CorePointer"

  Option         "Clone"         "off"

  Option         "Xinerama"      "on"

#Other screen position options are Below, Above, and LeftOf

  Screen         "Screen0" RightOf "Screen1"

  Screen         "Screen1"

EndSection

   

Section "ServerLayout"

  Identifier    "Single0"

  InputDevice   "Default Keyboard0"    "CoreKeyboard"

  InputDevice   "Default Mouse0"       "CorePointer"

  Screen        "Screen0"

EndSection

15.8.4 See Also

  • XF86Config(5x), for a complete description of all the available configuration options

    Previous Section  < Day Day Up >  Next Section