Guide to X11/Introduction
Introduction[edit | edit source]
This book, the Wikibooks Guide to X11 is about the X Window System. The target audience of this book is X11 users.
X11 is the graphical environment for most Unix or Unix-like systems, including *BSD and GNU/Linux; it provides access to screen, keyboard, and mouse. X11 is the Unix and Linux graphics drivers. Are you using Firefox, OpenOffice.org, GNOME, GIMP, or KDE with those systems? Then you are an X11 user.
This book is about the X Window System. Some users describe it as the Unix and Linux graphics drivers.
This chapter will explain the basics of X11, including:
- Why are there so many window managers and desktop environments?
- What is a console, and how does X provide access to it?
- What is the purpose of X servers and X clients?
- Is it possible for different X clients to interoperate?
X11 has diverse desktop environments[edit | edit source]
Most of the Unix and Linux distributions provide both a command line and X Window System. In Mac OS X, "X" is the version number "ten"; however, Apple and other parties provide X11 for Mac OS X, which allows you to use the X11 and native Macintosh window systems simultaneously.
However, just because so many systems provide X Window System, does not mean that it always looks the same. Some users of X have the GNOME desktop environment, some have the KDE desktop environment. Some use Xfce desktop environment while working with both GNOME and KDE programs. It is not as if all *BSD users have GNOME and all Linux users have KDE; instead, both *BSD and Linux users are split between those who use GNOME, those who use KDE, those who use other environments, and those who do not run X.
X11 gives choice of window manager to user[edit | edit source]
There are many different window managers for X. Most windows have decorations around them which provide features like moving, closing, resizing, and otherwise organizing the window. However, these decorations are not the same on every computer that runs X.
Window managers are those programs which make those decorations. Most window managers draw title bars, but some do not. Some window managers make no decorations, but provide menus or keystrokes for managing windows. Some window managers allow you to overlap windows, switch between windows, and hide windows temporarily.
Some window managers are older than both GNOME and KDE, and some users continue to prefer lightweight window managers to the heavy desktop environments that occupy more memory and computing resources. Many X11 users are running Metacity, the GNOME window manager, or KWin, the KDE window manager.
What is extraordinary about X is that there are many window managers to pick from. (This book lists at least 20 window managers.) As the user, you pick which window managers to install, configure, and use. You can have your own custom environment, unless you are not able to install or configure the window manager that you want.
However, though X allows only one window manager, it allows more than one window. Unlike Mac or Windows, X11 does not provide a standard interface or color scheme, so each window might be drawing its menus, scrollbars, and buttons in a different way. At least the window decorations will be the same on every window. For example, one can run Firefox and OpenOffice.org, and also programs from GNOME and KDE, all at the same time on one X server, because each program has its own window or windows. But if you are running Metacity, then you cannot also be running KWin at the same time, as these two are Windows Managers, and not desktop environments.
X provides access to the console[edit | edit source]
At the interior, the X window system has a special protocol - version 11 of the X protocol. The role of this protocol is give console access to programs like Firefox, OpenOffice.org, Nautilus, and Konqueror.
Each home computer or workstation has a console, which consists of a screen, mouse, and keyboard. In fact, some consoles have multiple screens and multiple input devices, like two mice or a mouse and touchpad. Typically, the Unix kernel only provides a console terminal. The kernel loads a text-only video driver and a keyboard driver and makes a text-only terminal, good for running a command line such as the Bourne shell and certain text-only programs like vi and NetHack.
If we want to draw graphics or use the mouse, we must run a program that knows how to do this. We start an X11 program called the X server. It loads a graphics video driver, a keyboard driver, and a mouse driver. Then, the X server allows programs to make a window. A window is a rectangular area where the program appears; one can type and click windows. X11 allows programs to share the console because it allows more than one window on the screen. (For example, one might have two Firefox windows and one OpenOffice.org window open.) This is the same function that Mac and Windows has.
X clients connect to X servers[edit | edit source]
When you start the X server, it changes the screen to grey and makes a mouse cursor. Then it waits. Like a web server, which waits for web browsers to connect, or an ssh server, which waits for remote logins, the X server waits for X clients to connect. An X client is a program like Firefox and OpenOffice.org which wants to make one or more windows on the screen.
Unlike Mac or Windows, the X server can accept network connections. While you use the X server on one computer, you can login remotely to another computer and then ask it to connect to your X server. This lets you see and use programs that are on other computers, even if those computers use X on different operating systems.
When an X client connects to the X server (on the same or different computer), it speaks version 11 of the X protocol. This is how the client tells the server what to draw, and the server tells the client what the keyboard and mouse input is. The many X clients never need to know about the hardware or operating system of the X server, because the X server controls the console. Clients like Firefox and OpenOffice.org only need to know X protocol.
X sometimes lets programs interoperate[edit | edit source]
X11 programs share a clipboard and fonts, but sometimes they have not much else in common. This led to incompatibilities in not only appearance, but function: drag and drop between applications was sometimes impossible, and use of the clipboard was inconsistent.
Now, with efforts at freedesktop.org and elsewhere, some programs not of the same desktop environment can cooperate. Desktop environments, such as GNOME and KDE, and less-used environments like Xfce, provide applications that work well with each other. The results of these efforts include:
- standard rules for using the clipboard
- cooperation between window manager and applications
- drag-and-drop between GNOME, KDE, and other windows
- improvements to the X server