.xinitrc

From DSL Wiki

   This page in other languages: español, deutsch, Русский, turkish


/home/dsl/.xinitrc

This script is run when the X server starts, and is used to run commands that require a graphical environment. Some common uses for .xinitrc are to start any X program automatically, to adjust X settings on a per-user basis, and, of course, to start your window manager.
The default .xinitrc file in DSL 3.0 looks like this:

       # put X windows programs that you want started here.
       # Be sure to add at the end of each command the &
       
       KEYTABLE="$(getknoppixparam.lua KEYTABLE)"
       DESKTOP="$(getoption.lua $HOME/.desktop wm)"
       ICONS="$(getoption.lua $HOME/.desktop icons)"
       
       # For non-US Keyboards
       if [ ${KEYTABLE:0:2} != "us" ]; then
         xmodmap -e "clear Mod4" -e "add Mod5 = Mode_switch" &
       fi
       
       #if egrep -qv noicons /proc/cmdline 2>/dev/null; then
       if [ "$ICONS" == 1 ]; then
         for x in `ls -1 .xtdesktop/*.hide 2>/dev/null`; do rm -f ${x%.*}; done
         iconsnap.lua &>/dev/null &
         xtdesk.sh
       fi
       dillo /usr/share/doc/dsl/getting_started.html &>/dev/null &
       torsmo 2>/dev/null &
       case $DESKTOP in
         fluxbox )
           fluxter &>/dev/null &
           wmswallow -geometry 70x80 docked  docked.lua &
           exec fluxbox 2>/dev/null
         ;;
         jwm )
           ./.background
           sleep 2
           exec jwm 2>/dev/null
         ;;
         * )
           exec fluxbox 2>/dev/null
         ;;
       esac

You might notice some differences in this file if you are using DSL 1.x. One significant difference is the "case" block, which was included with the addition of the JWM window manager. Having this case statement allows the user to start the window manager of his choice, along with windowmanager-specific applications, with a boot option or by editing a single line in /home/dsl/.desktop. Notice that there are different applications listed in each part of this block of code. This allows you, for example, to run fluxter with Fluxbox but not with JWM (in which fluxter does not work). Also notice that above the case command are commands such as dillo that will run regardless of which window manager is chosen.

For great emphasis....If you want to add a command to run automatically with X, the command should be above "case" if you want it to start with either window manager, or inside the section of the desired window manager for apps that you want started only for that window manager.

The ampersand (&) that follows many of the commands is there to allow the command to run in the background so the .xinitrc script can continue. Most applications will want this ampersand. Some commands, such as xset or xsri, run quickly and close immediately, so the ampersand is optional for these commands. The only command that you definitely do not want to follow with an ampersand is the final command that starts the window manager. If the window manager is started in the background the .xinitrc script will finish, X will close, and you'll be back to the commandline.

this page replaces the previous version, which was wildly outdated --mikshaw