Table of Contents
Linux is often seen as a command-only operating system. This is far from true: although its command-line is a powerful interface, you can also launch graphical environments on Linux. In this chapter, we briefly cover the graphical environments in Linux.
Graphical environments are the de facto standard for working with a workstation. Many users know the Microsoft Windows family or the Apple MacOS series. However, those two aren't the only providers of a graphical environment. When the Intel-compliant PCs were hardly known to the world, consoles and other personal computers already provided a graphical environment to their users.
It comes to no surprise to hear that the free software community also provides graphical environments. And, just like you have choice amongst distributions, you have choice amongst graphical environments: GNOME, KDE, XFCE4 are popular desktop graphical environments; enlightenment, fluxbox, window maker, icewm, ... are window managers.
Although most readers will be sufficiently fluent in using a graphical environment, this book wouldn't be complete if it didn't cover it. As such, and with the danger of being overly simple on the subject, this chapter will briefly cover the concept of graphical environments.
On Linux, a graphical environment consists of many components:
Widget Tool Kits
Each of those components interacts with others through specific interfaces.
An application is able to draw graphic components (buttons, windows, progress bars, labels etc.) through a common API called a widget tool kit. Popular widget tool kits on Linux are GTK+ and Qt. However, not all applications require a widget tool kit - they can also talk to the X server immediately. Using such tool kits however facilitates the development of graphical applications.
The widget tool kits communicate with the X server through an interface which basically drives all commands to a window manager. A window manager manages the layout of the users' screen: where are the windows positioned, can he drag windows from one location to another, how are buttons rendered, ... Popular window managers are Mutter (used by the GNOME desktop environment), KWin (used by the KDE desktop environment), fluxbox, enlightenment, ...
Most window managers are written for specific widget tool kits, but some of their functionality extends beyond one particular window manager: this allows window managers to support not only rendering of applications built with different widget tool kits, but also interoperability between these applications (copy/paste, drag 'n drop ...).
The window manager receives commands from the X server. The X server is responsible for turning requests into hardware-specific actions (draw window means to render a window through the graphic card, mouse movements are events coming from the mouse device and directed to the window manager to move the cursor, ...).
In the following sections, we dive a little bit deeper into each of those components...
On a Unix/Linux system, the X server is a tool which manages the graphical card on your system and offers services to draw things on your screen. These services are defined in the X11 protocol, an industry open standard. Because the interface is open, many X servers exist, one more powerful than the other. Popular X servers are Xorg and XFree86. However, on Gentoo Linux, Xorg is the only available X server (due to legal restrictions as well as support base).
To install Xorg on Gentoo Linux, I suggest to read the X Server Configuration HOWTO from Gentoo's documentation repository. It describes how to install Xorg, configure it to work with your hardware and more. This chapter only gives a quick introduction to this.
You should understand that the Xorg configuration defines, amongst other things,
the resolution and refresh rates of your screen(s)
the language used by your input (keyboard)
the drivers used to render stuff (i810, vesa, but also closed, proprietary drivers like nVidia and ATIs)
Once configured to your likings, do not forget to take a backup of your configuration (hint: some people place their X configuration online for others to see - there is nothing personal inside anyway).
INPUT_DEVICES="evdev keyboard mouse" VIDEO_CARDS="vesa intel"
In the above example, I selected the vesa video driver (a default driver that is supported by most video cards, but with little functionality) and intel video driver (as I have an Intel graphic card).
# emerge x11-base/xorg-server
Once finished, it is time to check out the graphical server environment.
Try out Xorg without using any configuration file. The Xorg server will try to automatically detect the necessary settings and, to be honest, does a fine job at that. Don't test out things as root though!
If you haven't configured a graphical environment yet, you'll be greeted with a console and an ugly background. However, that alone should suffice to verify if your mouse and keyboard are working as well as do a preliminary verification of the resolution of your screen.
If the graphical server doesn't seem to function properly, make sure to read up on Gentoo's Xorg Server Configuration HOWTO.
Window managers interact with the X server using the X11 interface and manage how your graphical environment looks like, but also how it behaves (for instance, there are window managers that do not support dragging windows).
Certain window managers are accompanied by various other tools that integrate nicely with the window manager. These tools offer services like a panel (from which you can launch commands or programs immediately), application menus, file manager etc. The aggregation of these tools is often called a desktop environment because it offers a complete desktop to the user.
Gentoo supports many window managers. To install one, simply emerge it.
For fluxbox, a popular, lightweight window manager, Gentoo even has official documentation available: the Fluxbox article.
The majority of Linux users use a desktop environment to work with their work station. The two most used desktop environments are KDE and GNOME. The third environment, XFCE4, is gaining momentum as a lightweight yet powerful desktop environment.
The GNOME desktop environment is the default desktop environment for many Linux distributions such as Fedora and RHEL. Its desktop is very simple to use: the number of visible options is kept low to not confuse users, and all applications that want to integrate with the GNOME desktop should adhere to various guidelines such as the user interface guideline.
Gentoo has a GNOME Configuration HOWTO available as well.
The KDE desktop is a fully featured desktop environment which offers all the functionality a regular user might expect from his system. KDE comes with many tools, ranging from network related tools (browsers, IM, P2P) to office tools, multimedia tools, authoring and even development environments.
Gentoo provides a KDE article.
The XFCE4 desktop is designed to still run smoothly on low memory systems (32 Mbytes and more). Often, power users use XFCE4 even on large memory systems just to reduce the memory overhead of the graphical environment.
Gentoo provides an XFCE Configuration Howto.
If you want to log on to your system using a graphical logon manager, you need to do two things:
Install a graphical logon manager
Setup the default graphical environment
The desktop environments KDE and GNOME provide their own graphical logon manager (which are called kdm and gdm respectively). If you don't have them or want to use a different one, I recommend x11-misc/slim. It is a lightweight graphical logon manager.
# emerge x11-misc/slim
Once a graphical logon manager is available, configure the xdm service to use it.
Finally, add the xdm service to the default runlevel.
# rc-update add xdm default
The graphical environment can also use 3D acceleration.
Now, 3D acceleration is a tricky subject because there are many implementations that offer 3D services. For instance, you can have 3D services with software rendering (i.e. no delegation of rendering to specific 3D hardware) but this usually isn't seen as 3D acceleration.
When you have a graphic card capable of rendering 3D, you will need to configure the X Window System to hand over 3D rendering tasks to the graphic card. This can happen through either open standards or specifications (such as OpenGL) or through closed, proprietary drivers (such as the nVidia drivers).