Thursday, June 21, 2007

Controlling your X - really deep down

amazing post by From: Andrew Sackville-West
If you want to experiment, there are a few things you can try. I would
start with, as root:

update-rc.d -f gdm remove

this will remove the symlinks to gdm in the your rc levels so that you
can start up your machine without gdm starting up. If you later want
to start up gdm manually, as root do:

/etc/init.d/gdm start

if you later want to redo gdm so it start automatically, then do, as

update-rc.d gdm defaults

to recreate the symlinks for automatic start-up. Will take effect next
reboot, or next time you change run-levels.

Okay, now you can start your machine and log in from the command line
on a VT. edit a new file in your home directory and call it
".xinitrc". The "." is important.

put one thing in that file


and save the file. now logged in as yourself, type


you should see the usual X screen come up and then it will pop-up an
xterminal for you. you cna play around for a bit and then type exit
from the xterm and you will drop out of X and return to the CLI. Some
fun things you can do here are: 'iceweasel &' in the xterm to start up
iceweasel. you can use this xterm as a sort of session manager by
starting whatever x apps you need from it.

what happened? you started a bare X session, without a *dm and using
~/.xinitrc, told it to run the X app pointed to by
"x-terminal-emulator" (part of the alternatives system, which is
another issue altogether).

you could have easily specified *any* x app. change .xinitrc so that
it has only the line:


and then try startx again. you should get a screen full of iceweasel
only. When you quit, you'll drop back to the CLI again.
onwe more quick lesson and then we'll move on:

edit xinitrc again and put in

x-terminal-emulator &

save it and try startx. It should start an xsession, launch an xterm
and then because the xterm is backgrounded (by the &) then X will move
to the next line of xinitrc, and with nothing there, will kickout and
drop back to the command line. This is proper behavior. X will run
until it reaches the end of your .xinitrc and then it will die. To
keep your x session running, the last program in xinitrc must stay
running in the foreground.

Now have fun. install a few window managers. edit your .xinitrc:


and run startx. a window manager is just like any other x program. It
keeps your x session going until it exits. But a wm has lots of other
cool features -- it lets you launch other x apps, it helps you contorl
the size and placement of the windows. it provides handy menus, etc
etc etc.

you can put lots of things into your xinitrc... at one point mine
looked like this, which is pretty simple, but give syou an idea

eval `gpg-agent --daemon --sh`
numlockx on
xscreensaver -no-splash &
rox-filer --pinboard=mypinbd
xsetbg -fullscreen /home/andrew/earth2a1.jpg &

this did several things: started my gpg-agent, turned on numlock (must
be on for my sanity), launched the screensaver, started up rox-filer
and my desktop stuff from there (rox-filer daemonizes itself and
doesn't need the &), set my background image with xsetbg and finally
launched icewm-session, which pulls in a whole bunch of icewm
stuff. I used that setup for about a year before moving on to wmii for
a while.

The point of all this is, if you *really* want control of your
desktop, this is a way to do it. have fun
Andrew Sackville-West

You don't have to uninstall anything. Just install a lightweight window
manager such as IceWm and change the preferred x-session-manager to
icewm-session, e.g.:
# aptitude install icewm
# update-alternatives --config x-session-manager
(Select icewm-session)

what is links2 browser
What will the end result look like? Personally, I don't use any gdm or
any other *dm, I just log into a normal terminal and run startx, which
starts icewm (on my PII) and Xfce on my Athlon. I went with Xfce over
icewm simply because I can edit the tool bar and other stuff with a
simple config applet instead of editing config files for icewm.
However, my PII only has 64 MB ram whereas my Athlon has 1 GB. Xfce
tends to leak memory.

No comments: