Flag This Hub

Linux for Users: Installing a Lightweight Desktop

By


The standard fvwm desktop.
See all 2 photos
The standard fvwm desktop.
An OpenMotif desktop.
An OpenMotif desktop.

In comparison with other operating systems, Linux often gets criticized for not having as complete a desktop environment as, for example, Microsoft Windows or Macintosh OS X. While most Linux distributions offer the GNOME desktop environment, Linux owes its design to the UNIX operating system, which was meant to run on mainframe and minicomputers which were sometimes, but not always, connected to a lot of text-mode terminals.

Linux and its related operating systems use a graphical user interface called the X Window System, which from the earliest days of its design ran independently of the operating system. The environment is so flexible that a computer running UNIX or one of its relatives can operate equally well with or without the desktop. UNIX users can use the shell command line, a remote login, or one--or even several--of the desktop packages available on the Internet. You can take advantage of this fact by installing your own GUI desktop.

There are several reasons why you might want to do this.

  • You find that the GNOME desktop is too generic and either does not provide tight integration with, or gets in the way of, the software that you normally use.
  • The standard desktop uses a lot of computing power, and you find that your system is running low on either disk space or memory or processor power, and instead of buying or upgrading a computer, you'd prefer to use its resources more efficiently.
  • Lightweight desktops have been around longer. The code is more compact and mature, and offers a more stable environment if you do any testing of new software. You can also test new programs by changing easily between different environments

These desktop programs are often called, "window managers," and they are a type of X graphical client. Window managers are independent programs that run continuously and use the X server and libraries to open windows when you start programs, pop up menus, manage a clipboard, and generally control the appearance of the desktop's windows and background.

GNOME's enviroment uses a window manager, and here we'll describe how to replace it.

There are many window managers available as part of the X Window System or available for download. I'm going to describe only two of the more popular programs here: "mwm," which is part of the widely used OpenMotif library, and "fvwm," which started life at about the time that the X Window System was first adapted to Linux. Both have been around for a long time and are very stable, and if you have a current Linux system, you can install them without too much trouble.

These programs provide almost opposite approaches to how to manage a desktop configuration. Fvwm can display many different types of graphical programs and accessories in its application dock and menus. The Motif environment, however, presents a spare display; its flexibility is, "under the hood." The, "mwm," window manager allows you to manage program and desktop configurations using the graphical programs' X resources. You can try them both to decide which one you prefer. Also, there are many other window managers available on the Internet. Keep in mind that window managers are normal programs, and you can have as many different ones on the system as you like, and you can switch between them whenever necessary.

Installing the Software

You can download the window managers from http://www.fvwm.org and http://www.openmotif.org, respectively, by following the instructions on each site. Building each of them follows the same procedure.

$ tar zxvf <package>.tar.gz
$ cd <package>
$ ./configure
$ make
$ su 
  <enter your superuser password>
# make install

If something doesn't go right, then check that you have all of the libraries installed. Escpecially check that you have the, "dev," packages of each feature you want; for example, the font and graphics libraries, because they can vary.

OpenMotif seems to be more current with my Linux distribution; on the other hand, "fvwm," has more configuration options. My system couldn't get fvwm's, "FBidi.c," module to compile, so I simply configured fvwm not to use it, because I don't use bidirectional type anyway.

$ ./configure --disable-bidi

Configuring and Starting the Programs

You can do a little configuration of, "mwm," before starting it. The configuration of, "fvwm," however, uses numerous dialogs and wizards, so you can start, "fvwm," and follow the instructions there.

If you're using, "mwm," you need to manually copy its configuration file to your home directory.

$ cp /usr/X11R6/lib/X11/system.mwmrc .mwmrc

Note: This next step is perhaps the only remotely dangerous step in this entire process. You need to tell X Window System server to use this window manager. If you happen to mess up this step, don't panic. Systems with graphical login screens generally offer a failsafe session that you can use to correct errors, or if you log in using a text-mode terminal, you can simply shut down the X display by typing Ctrl-Alt-Backspace. If you somehow manage to get into a serious mess, you can reboot the computer into single user mode, or have an emergency disk nearby.

As with many configuration settings, the system checks for your own configuration and uses that instead of the default settings, so none of the system's files need to be modified.

The exact process depends on the system. Most Linux distributions today offer a graphical login, but if you have an older system, you may still need to log in using a text mode terminal.

If you have a graphical login screen, the display manager, when logging you in, checks for a file called, ".Xsession," in your home directory. If the display manager finds the file, it uses the commands there. If you start the GUI with the, "startx," program, then you need to put the commands in a file called, ".xinitrc."

Note: If you use a, ".Xsession," file, it must be executable. Making an, ".xinitrc," file executable does not affect its operation. To do this, add the following line to the start of the, ".Xsession," file:

#! /bin/bash

Then give the file execute permissions.

$ chmod +x .Xsession

If you don't do this, you'll be returned to the login screen after a brief pause, then in the system's errors logs--the display manager places one of them in your home directory, called, ".xsession-errors," should something fail--you'll see errors like, "permission denied," "cannot execute," and other similar messages.

Now that we've gotten past the dangerous parts, we can concentrate on how to start the program. At a bare minimum, the file should contain the full path to the window manager. In the case of, "fvwm," your, ".Xsession," or, ".xinitrc," file would contain the following as the last line in the file.

/usr/local/bin/fvwm

In the case of the, "mwm," program, the configuration files, ".Xsession," or, ".xinitrc," would contain the following as the last line.

/usr/bin/mwm

The reason I've emphasized this is that the window manager runs continuously for the duration of your session. This is why I made a point of mentioning, above, that window managers are simply graphical programs, although they have some unique capabilities. That means when a window managers exits, the display server shuts down, and the system returns you to the screen where you were before you started the desktop session.

Configuring the Desktop

As I mentioned above, these desktops have different approaches to customization. Mwm is, for beginners, the more difficult to configure because, like many other programs, it uses X resources for configuration. Fvwm, on the other hand, uses its own configuration language.

I prefer using X resources for configuration because it allows you to adjust the appearance and settings of individual programs. They are not loaded automatically when the desktop starts; you need to tell the server to load the resources. The X Window System provides a utility, "xrdb," that does this.

So add a line to your .Xsession file to run, "xrdb," with your own resources file.

#! /bin/bash
/usr/bin/xrdb -merge /home/unixb4coffee/.Xresources
/usr/bin/mwm

Also, while we're on the subject, if you prefer to swap the control and caps lock keys on your keyboard, add this line to the, ".Xsession," file.

/usr/bin/setxkbmap -option ctrl:swapcaps

Then create a file in your home directory called, ".Xresources." This is what contains the configuration settings of each program. One of my favorite settings is to focus on whatever window I move the mouse to. It saves a lot of mouse clicks. To do this with, "mwm," add the following lines to the, ".Xresources," file.

Mwm*focusAutoRaise: true
Mwm*keyboardFocusPolicy: pointer

You can re-read the resources by typing, "xrdb ~/.Xresources," from the command line and then restarting the window manager.

To accompish the same task in, "fvwm," add the following line to the end of your, ".fvwm2rc," file. The file should reside in a subdirectory called, ".fvwm."

Style * MouseFocus

As you've noticed, you generally can adjust these settings according to your personal taste. I'll just mention a few that I use. Fvwm displays the entire window when moving it, while, "mwm," simply displays a placement grid. To get, "mwm," to show the window while moving it, add the following line to the, ".Xresources," file.

Mwm*moveOpaque: true

Another matter of taste is the accessories on the desktop--the clock, calendar, a battery guage if the system is a notebook, and so on. Fvwm, like many recent enviroments, allows you to dock appications, or applets, on the desktop. It also allows you to dock applications written for other window managers.

But I like to paste the accessory programs on the background of the desktop, which would be wasted space otherwise. I have several favorites, "xdaliclock," and "xdeskcal," which you can find on the Internet, and which both use transparent windows, so the applications work very well as part of the background wallpaper. Mwm allows us to create windows without borders, which, "fvwm," doesn't, because it relies instead on the application dock.

First, add the lines to start the applications to your, ".Xsession," file, so it looks something like this.

#! /bin/bash
/usr/bin/xrdb -merge /home/unixb4coffee/.Xresources
/usr/bin/setxkbmap -option ctrl:swapcaps
/usr/local/bin/xdaliclock &
/usr/local/bin/xdeskcal &
/usr/bin/mwm

Note that the desktop programs start in the background, which is done by adding the ampersand after the command.

Next we configure the applications by setting some resources in the, ".Xresources," file.

xdaliclock*geometery: -1-1
xdaliclock*transparent: true
xdaliclock*font:  -*-times-bold-r-*-*-24-*-*-*-*-*-*-*

xdeskcal*gemoetry: +1+1

Note that we need to set the window placement with the, "geometry," resource. Most X applications regard it, and it's necessary here because we won't be able to move the applications if we display them without window borders.

Then we add the resources for the borderless windows. Note that these are mwm's resources, not the application's resources.

Mwm*xdeskcal*clientDecoration: none
Mwm*xdaliclock*clientDecoration: none

There are of, course, many, many things that you can configure on each of these desktops. For starters, refer to the manual pages for each program or browse for them on the Internet.

Comments

No comments yet.

Submit a Comment
Members and Guests

Sign in or sign up and post using a hubpages account.



    Like this Hub?
    Please wait working