Sunday, September 23, 2007

X is NOT KDE!

Or put in pure Linux/Unix terms: X != KDE. Or Gnome, XFce4, Fluxbox etc etc.

As Linux (Linux defined here constitutes an entire distribution. In real terms, linux of course is the kernel only and a distribution, like Slackware, RedHat, Ubuntu etc are collections of programs which include the kernel.) grows exponentially in popularity there are many misnomers cropping up regarding what is what. While these misnomers are mostly harmless they do make diagnosing problems that may crop up harder for us more knowledgeable long time users.

For example. I saw a discussion recently on a forum where the user with a screen blanking problem kept referring to "The screen blanker in KDE." After much discussion going back and forth it eventually transpired that he/she was using Ubuntu. Ubuntu hides the underlaying console that all distributions have and boots straight into Gnome, by default, or KDE. This user had changed the default so instead of logging directly into GDM (the gnome login manger) from where he/she could log into Gnome or KDE he/she automatically booted directly into KDE.

Nothing wrong with this method and can in fact save a little bit of time logging in. This method also facilitates booting ones machine then walking away to do something else. On return the machine will be sat on the Gnome, KDE etc desktop so one can start work immediately upon returning to the station.

Where this sort of auto login does become an issue is when, for whatever reason, ones X or Gnome/KDE has been irreparably broken so that instead of being sat on the desktop one is sat at a scary black screen with nothing more than a bit of text at the bottom.

And so this discussion went. He/she was not having a problem with KDE but did have a problem with X blanking the screen. however, his/her constant use of "The screen blanker in KDE" kept throwing us old timers off the scent of where the problem really laid.

In very simple terms the boot process boots in 3 separate stages. First, the console, second, X and third ones chosen GUI which can be any one of many but most new users tend to use Gnome, KDE or XFce4. To blank or stop blanking the monitor each one of these stages should be addressed separately. Of course if one never uses the console directly that stage can be missed out. None of the GUI's have screen blanking themselves. Instead they offer, via their setup or configuration applets, options to setup the default GUI screen blanker which is a program called xscreensaver.

So, for console blanking we use 'setterm -blank <time in seconds>. If the value of (time in seconds> is set to 0 then blanking is disabled. Any other none negative value will blank the console after those minutes of inactivity.

For X this is a little more tricky insofar as how one goes about setting this up, but works fine once set up. If one does not add these options to /etc/X11/xorg.conf the default options, which are for X to blank the screen after 5 or so minutes of inactivity, kick in. To set X to blank the screen after so many minutes of inactivity, open /etc/X11/xorg.conf in your editor of choice. We need root access for this so use 'su' to gain root privilidges or 'sudo'. Add the following lines to 'Section "ServerLayout"' in /etc/X11/xorg.conf.

Option "BlankTime" "0"
Option "standby time" "0"
Option "suspend time" "0"
Option "off time" "0"

These options totally stop X from blanking the screen.

The third part is simple and for a new user probably the easiest way to blank or stop blanking the screen. Gnome, KDE, XFce4 or any desktop environment or any window manger for that matter do not contain any screen blanking code beyond offering configuration options for the xscreensaver program. By setting these options up one can disable screen blanking in your chosen GUI environment.

I hope you found the information given here useful and please, new users to Linux, try not mixing up the various parts that make the whole and we old timers will be better able to help you with whatever problems you may be experiencing.