Artist's Guide to the Desktop, Part 2

In this episode, Mr. Hammel tells us all about Enlightenment 0.16.1.

It's a simple fact of the desktop world: artists, like all other users, want lots of screen space. Enlightenment gives it to them, when they want it, and on their terms. Enlightenment, usually referred to as E, allows users more control of their desktop than just about any other window manager. Where Window Maker and AfterStep are highly configurable, E is downright malleable, bending and twisting to the delight of its users.

Window managers today share some common threads. They usually allow some level of configuration for the Title Bar. Most have some form of pager that allows the user to switch between virtual desktops and, in some cases, multiple pages within each desktop. They all support icons and most have either some form of icon box or a way of specifying where icons should be displayed on the desktop. All have menus for accessing applications and managing the system as a whole.

E takes all this a bit further. Perhaps you've seen the fancy window borders for which E gained its fame. Those are the themes you've heard so much about, the personalization that the Windows world calls “skins”. What you may not have seen are the various ways you can jump from desktop to desktop. You can drag windows between any page on any desktop, using the fully configurable pagers (one pager for each desktop). You can also slide desktops around, like giant sheets of paper, so that the top sheet only partially obscures the one below it. None of the other window managers has this particular feature. Some might call it fluff, but having quick access to your desktops in a point-and-click manner is a real joy for heavy users like me.

In this article, I will look at the configuration and use of E from the perspective of an artist—someone who wants to define not only his own unique look for the desktop, but also how the desktop should work. Although key and mouse bindings are completely configurable right from the desktop in E, I'm going to discuss configuration using the default bindings. I'll also use the default themes, just so you don't get too confused by my own unique world.

I will assume you are not afraid of compiling and installing from source-code distributions. E is a powerful system, but it's young and still in early development. You can find fairly recent versions of E with most recent Linux distributions, although you may specifically have to request to have it installed. Additionally, since E is young and in a constant state of being updated, you will want to be familiar with building and installing software if you plan on getting serious with E. Getting and installing E are discussed in the article “Enlightenment Basics”, which can be found in this month's “Strictly On-Line”.

Up and Running—The First Time

Once you have the E environment ready, you can configure your login account to use it. The X Window System is arguably the most configurable user environment ever created (second only to Martha Stewart's kitchen). There are many ways you can configure your window manager after it's running, but determining which window manager to run can often be confusing. Big-name distributors of Linux desperately try to hide the apparent complexities of configuration from the user so that the desktop appears automatically configured. Fortunately, try as they might, it's easy to find a way around this.

The key comes in two parts: startx (and its compatriot, xinit) and the $HOME/.Xclients configuration file. startx is a shell script with a history that goes back to the early days of X. It's a fairly simple script, created to make using the more complex xinit (which is used to start the X server and any initial applications) easier for the typical user. Developers tend to build complex systems, only to spend the rest of their lives adding front ends and wrappers around them to simplify them for “the typical user”. xinit will exist on all Linux systems with X installed. startx should be on all systems, although a few distributors may remove it in favor of their own homegrown version. If you're using one of those, dump it. There are cases where keeping historical pieces of software available, even if more advanced pieces become available, is advantageous. This is one of those cases. You should be able to find both xinit and startx under /usr/X11R6/bin.

X Session

As long as you use startx/xinit to launch your X session, you can make use of the .Xclients configuration file to determine what X will start. xinit eventually reads this file, which should be located in your $HOME directory, starts the X server, then runs the commands specified in .Xclients. For example, you might specify that two xterms, xclock and xcalc all start up along with E. Such a configuration might look like this:

xterm &
xterm -bg black -fg wheat -geom 80x30\
   -font 7x13 &
xclock &
xcalc &<\n> enlightenment

Notice that this file looks like an ordinary shell script, but you don't have to specify the shell to use (i.e., there is no #!/bin/sh line at the top of the file) because the standard shell, /bin/sh, is used. Each line is a command to run, and, with the exception of the window manager line, each command must be placed in the background using the ampersand. The last command is normally the window manager of choice. No matter which command is last, it shouldn't be placed in the background. If it were, xinit (via startx) would then see that the commands file (.Xclients) has completed. This would cause xinit to exit, bringing your X session to an end and returning you to the text console.

Create an Xclients file like the one in the previous example. If X is already running, which is likely for most users who accepted the default configurations provided by their Linux distributions, you can still use any editor (I use vi) and save the file to $HOME/.Xclients. This won't affect your current X session, but when you log out and log back in the next time, you'll get the new configuration. Quick tip: if you get lost, rename .Xclients to .Xclients.orig and exit your X session. The next time you start your X session, you should be back to where you were previously.

Now you have a simple Xclients file and you're ready to start your X session. If you use a graphical login, you're all set. Your new configuration will start up on your next login. If you use a text console login and manually start your X session, just type startx. In either case, should you get lost or confused and want a quick exit, you can type CTRL-ALT-BACKSPACE to kill the X server and return to either the graphical login or text console. Quick Tip 2: remember that CTRL-ALT-F2 should take you to a text login console, and CTRL-ALT-F7 should take you back to your X session or graphical login.

The first time you start E, you'll see something like Figure 1. E comes with a built-in help system. The large window in the middle of the screen is the Document Viewer, which is used to navigate the help system. This window opens the first time you use E and will open each subsequent time until you exit the Document Viewer. The on-line help isn't difficult to follow, and you should read through it thoroughly at least once. If you look closely, you'll also see one of the informational dialogs from E. This one states that a default menu configuration has been built for you.

Figure 1. Default Desktop

“Enlightenment Basics” described the fnlib library. That library gives E access to some interesting fonts. The Document Viewer, showing the on-line help, shows the default font for this application. This is your first clue as to how E differs from other window managers. You can create some very unusual scalable fonts for use in E. The best way to learn how to do so is to examine the documentation provided with the fnlib source-code distribution.

What happens to the applications started with .Xclients? Most will exit once the .Xclients script exits, and that happens when you exit your window manager. But if some applications don't exit, you can add code (just like any shell script) to .Xclients to force those applications to exit. Remember that in an emergency, you can kill off your X session with CTRL-ALT-BACKSPACE, although once you become familiar with E's menu system, you should use the menu options provided for exiting.

Now, back to your first login. What you're looking at requires a little explanation. First, most modern window managers provide multiple virtual desktops. You start out with two desktops with E's default configuration. You can tell that there are two because you have two pagers (lower-left corner of Figure 1). Each desktop can have multiple pages. E's default provides two pages per desktop. The number of desktops and pages per desktop are all configurable using graphical interfaces (i.e., you don't have to edit configuration files manually to change these). We'll talk a little more about configuration a little later, after we've finished our tour of the E environment.

Across the top of Figure 1 is the drag bar. This bar is to desktops what the Title Bar is to windows; it allows you to drag desktops up and down. Unlike other window managers, you can actually view and work in two desktops at the same time with E.

In the lower-right corner of Figure 1 is the default Icon box. It has a slider along its bottom edge, which can be used to scroll icons left and right if there are more icons than can be displayed in the box. Like most things in E, the size of the icons, their arrangement (rows and columns), the number of icon boxes and many other items can be configured using graphical configuration utilities.