MANUAL for vidswitcher NAME vidswitcher - video switcher SYNOPSIS vidswitcher [ options ] COPYRIGHT JT Moree, vidswitcher AT pcxperience.org, 2006. Released under the Gnu GPL Version 2 DESCRIPTION This script will automatically choose X configurations so that you can quickly and easily change for different situations. As an example, my laptop needs a different X Config when I have a monitor plugged in. I used to manually run the script to change the configs. (Use -m option). Then I used different runlevels to decide whether or not the monitor was plugged in at boot. Now the script detects when the monitor is plugged in using /proc/acpi. (requires acpi 'video' kernel module) I can boot with or without the monitor plugged in and the script chooses the correct configuration. OPTIONS Run with no options The default mode of operation is to detect the runlevel and check for acpi support. Then the correct file is found for those settings and copied into place. -m Menu mode will output a list of available configuration files to choose from. If the user chooses one it will be copied into place. -a Auto mode will run the detection routines to create a new config. This uses X.org --configure and I often find it to be lacking in it's abilities. CONFIGURATION/SETUP The configuration file /etc/vidswitcher.conf must exist and have at least the following parameter set: CONFIG=/path/to/Xconfig This is normally /etc/X11/xorg.conf but might also be the older XF86Config depending on your system. Some optional parameters are: PROFILEDIR=/etc/X11/vidswitcher AUTOX="X -configure :99" AUTOFILE=/root/XF86Config.auto PROFILEDIR tells us where to get the user's alternate configurations. The default location is /etc/X11/vidswitcher but can be changed with this parameter. Put your different X configurations here. A good idea is to name them something meaningful so you will know what they are when running in menu mode. i.e. (800x600, 1024at60, twinview, xinerama, ) AUTOX is a command to run for creating a new configuration. x.org has an option of -configure that will try to detect system settings and write a new file. It is often sub par in it's abilities. If you have some other detection routines you can have them run by putting them here. AUTOFILE is the location where the new X configuration will be output so that we can copy it and use it for the system. PROFILES The X profiles are to be put in PROFILEDIR. You should copy your current profile to that directory and call it default (or something). If you need to change out profiles for connecting your laptop to a projector you might put a copy of that profile in PROFILEDIR and call it projector. You can name profiles anything that is a valid file name but hidden files will not show up (hidden files begin with a period). If you had followed the just mentioned advice you would have two files: /etc/X11/vidswitcher/default /etc/X11/vidswitcher/projector MENU MODE This is pretty simple. When you run vidswitcher with the -m option it will display the list of files in PROFILEDIR and present a menu. The first option will be to exit without doing anything. All other options will copy the specified config into the location specified in CONFIG (normally /etc/X11/xorg.conf). This WILL NOT make a backup of the original file. That should be done during installation. NON-INTERACTIVE MODE (default behaviour) If you want the config to change automatically you will need to configure runlevel support. USE RUNLEVEL TO CHOOSE CONFIG 1) Setup a service for vidswitcher. To do this make a symlink /etc/init.d/vidswitcher -> /usr/sbin/vidswitcher. Setup the appropriate links to each runlevel On debian you would run the command update-rc.d vidswitcher defaults 2) Run the command `runlevel` and create a hidden directory with that name in the PROFILEDIR (normally /etc/X11/vidswitcher). i.e if runlevel is 5: mkdir /etc/X11/vidswitcher/.5 3) Make a copy (or symlink) of the config you want to be the default for that runlevel in that directory and call it 'default' i.e. /etc/X11/vidswitcher/.5/default -> ../MyXF86Config The next time vidswitcher is run in that runlevel without the -m option this file will be used as the config. ACPI support To use acpi states as a condition for choosing configurations your hardware will need to support it and you will need to load the acpi 'video' kernel module. ACPI can detect when a display device is plugged in. In my case, I have a laptop where I use the LCD for the primary display device but when I am at home I also plug in a monitor. My system cannot use the same config for both cases. vidswitcher detects that the monitor is plugged in using acpi and chooses the appropriate file. 1) Make sure you load the acpi kernel module 'video' (modprobe video or put in modules.conf or equivalent) 2) Decide which runlevel will be used by default 3) create a file called ORDER in the runlevel directory with the names of devices that you want to look for and the order to search. Use a space between each name. Current devices supported are CRT, LCD, and TV i.e. I want the CRT to be searched for first so my order file contains /etc/X11/vidswitcher/.5/ORDER contains "CRT LCD" If you have a TV out configuration you can include it too. TV CRT LCD 4) Next create the files for the supported devices using the same names. i.e. /etc/X11/vidswitcher/.5/CRT -> ../MyCRTconfig /etc/X11/vidswitcher/.5/LCD -> ../MyLCDconfig /etc/X11/vidswitcher/.5/TV -> ../MyTVconfig 5) to recap, you should now have files and directories which look something this /etc/X11/vidswitcher/ /etc/X11/vidswitcher/CRTConfig /etc/X11/vidswitcher/LCDConfig /etc/X11/vidswitcher/TVConfig /etc/X11/vidswitcher/.5/ /etc/X11/vidswitcher/.5/default /etc/X11/vidswitcher/.5/ORDER /etc/X11/vidswitcher/.5/CRT /etc/X11/vidswitcher/.5/TV /etc/X11/vidswitcher/.5/LCD /etc/X11/vidswitcher/.2/default and so on . . . BUGS Email bug reports to vidswitcher AT pcxperience.org