X and Fluxbox :: Load my way



adssse, The .xinitrc is the startup file for X windows.  It's a shell script with a list of programs to run when X windows starts, and the last line is the windows manager (fluxbox or in some cases ion or twm).  Here's the one that comes with dsl:

Code Sample
# put X windows programs that you want started here.
# Be sure to add at the end of each command the &
if egrep -qv noicons /proc/cmdline 2>/dev/null; then
 enhance &>/dev/null &
fi
dillo /usr/share/doc/dsl/getting_started.html &>/dev/null &
fluxbox 2>/dev/null


The first two lines are comments.  A comment line starts with a # character.  Use as many comments as you want to.

The third line is the beginning of an "if" statement.  If the statement is true, then it runs the line below it until the "fi" which ends the if statement.  This particular if statement runs grep (a pattern matcher) to look in the file /proc/cmdline for the absense of the word "noicons."  /proc/cmdline holds the text you typed at the boot: prompt.

The fourth line is an example of a program to run.  This program (enhace) happens to be a shell script.  It contains a bunch of dock apps to load.  Notice the &>/dev/null &.  The &>/dev/null part sends any text output from the program being run to /dev/null, effectively throwing it away.  The & at the end runs this program in the background.  In other words, it goes on with the next command even if the command you put in the background is still running instead of waiting for it to finish.

Line 7 starts up dillo, the web browser.  You could start anything you know you want running when you start X windows, say beaver or Firefox.  Give whatever command line arguments you need and make sure to end the line with a &>/dev/null &

Line 8 starts fluxbox, which is the X windows manager we use.  X draws on the screen and handles the low level graphics details; fluxbox handles what windows look like, how they move, and how they are controlled.  The last line doesn't get the & at the end of it.

The .xinitrc I showed you was much simpler, just a list of files and a window manager (fluxbox) at the end.  You can make an .xinitrc far more complex that either of these if you want to using bash scripting commands.

Thanks for the explanation clacker, I really appreciate you taking the time to explain this. I think I understand it quite a bit better now.
It is so useful for me ,NB. Thanks so much.

original here.