diff --git a/en_US.ISO8859-1/books/handbook/x11/chapter.sgml b/en_US.ISO8859-1/books/handbook/x11/chapter.sgml index 4ec99d9482..28b0d24403 100644 --- a/en_US.ISO8859-1/books/handbook/x11/chapter.sgml +++ b/en_US.ISO8859-1/books/handbook/x11/chapter.sgml @@ -1,1480 +1,1420 @@ The X Window System Synopsis FreeBSD uses XFree86 to provide users with a powerful graphical user interface. XFree86 is a open-source implementation of the X Window System. This chapter will cover installation and configuration of XFree86 on a FreeBSD system. For more information on XFree86 and video hardware that it supports, check the XFree86 web site. + url="http://www.XFree86.org/">XFree86 web site. After reading this chapter you will know: The various components of the X window system, and how they interoperate. How to install and configure XFree86. How to install and use different window managers. How to use TrueType fonts in XFree86. How to setup your system for graphical logins (XDM). Before reading this chapter you should: Know how to install additional third-party software (). Understanding X - If you are familiar with using windowing systems that ship with - other operating systems, such as Microsoft Windows, or MacOS, then you - may find your first introduction to X to be something of a culture - shock. + Using X for the first time can be somewhat of a shock to someone + familiar with other graphical environments, such as Microsoft Windows or + MacOS. - Today, as Unix desktop environments such as - KDE and GNOME become - more prevalent it is less necessary to understand all the - behind-the-scenes interaction between the various X components, or what - those components actually are. However, one of X's strengths is its - underlying design, which lends a great deal of flexibility, and makes it - possible to do things with X that are impossible with other, more rigid, - systems. + It is not necessary to understand all of the details of various + X components and how they interact, however, some basic knowledge makes + it possible to take advantage of X's strengths. Why X? X is not the first window system written for Unix, but it is the most popular. X's original development team had worked on another window system before writing X. That system's name was - W (for Window, obviously). X is just - the next letter in the Roman alphabet. + W (for Window). X is just the next + letter in the Roman alphabet. - X can be referred to variously as X, X - Window System, X11, and other terms. - X Windows is to be avoided wherever possible; see - &man.X.1; for more information. + X can be called X, X Window System, + X11, and other terms. X Windows is + to be avoided wherever possible; see &man.X.1; for more + information. The X Client/Server Model X was designed from the beginning to be network-centric, and adopts a client-server model. In the X model, the X server runs on the computer that has the keyboard, monitor, and mouse attached. The server is responsible for managing the display, handling input from the keyboard and mouse, and so on. Each X application (such as XTerm, or Netscape) is a client. A client sends messages to the server such as Please draw a window at these coordinates, and the server sends back - messages such as The user just clicked on your OK + messages such as The user just clicked on the OK button. - If you are using FreeBSD in a home or small office environment - where you only have one computer then you will be running the X - server and the X clients on the same computer. However, if you have - many machines running FreeBSD it is perfectly possible to run the X - server on the computer by your desk (which might be quite a low - specification machine) and run your X applications (the clients) on - the powerful expensive server that serves your office. In this - scenario the communication between the X client and server takes - place over the network. + If there is only one computer involved, such as in a home or small + office environment, the X server and the X clients will be running on + the same computer. However, it is perfectly possible to run the X + server on a less powerful desktop computer, and run X applications + (the clients) on, say, the powerful and expensive machine that serves + the office. In this scenario the communication between the X client + and server takes place over the network. - This confuses a lot of people, because the X terminology is + This confuses some people, because the X terminology is exactly backward to what they expect. They expect the X server to be the big powerful machine down the hall, and - the X client to be the machine on their - desk. + the X client to be the machine on their desk. - As long as you remember that the X server is the machine with - the monitor and keyboard, and the X clients are the programs that - display the windows you will not get confused. + Remember that the X server is the machine with the monitor and + keyboard, and the X clients are the programs that display the + windows. - There is an interesting side-effect to this design. There is - nothing in the protocol that forces the client and server machines to be running - the same operating system, or even to be running on the same type of - computer. It is perfectly feasible to run an X server on Microsoft - Windows or Apple's MacOS, and there are various free and commercial - applications available that do exactly that. + There is nothing in the protocol that forces the client and + server machines to be running the same operating system, or even to + be running on the same type of computer. It is certainly possible to + run an X server on Microsoft Windows or Apple's MacOS, and there are + various free and commercial applications available that do exactly + that. The X server that ships with FreeBSD is called XFree86, and is available for free, under a license very similar to the FreeBSD license. Commercial X servers for - FreeBSD are also available, should you want one. + FreeBSD are also available. The Window Manager The X design philosophy is much like the Unix design philosophy, - tools, not policy. By this we mean that X (and Unix) - does not try to dictate to the end user how they should accomplish - whatever task they are trying to solve. Instead, they aim to provide - the user tools to do the job, and it is the user's responsibility to - decide how to use those tools. + tools, not policy. This means that X does not try to + dictate how a task is to be accomplished. Instead, tools are provided + to the user, and it is the user's responsibility to decide how to use + those tools. This philosophy extends to X not dictating what windows should - look like on screen, how you move them around with your mouse, what - keystrokes you should use to move between windows (i.e., + look like on screen, how to move them around with the mouse, what + keystrokes to should use to move between windows (i.e., Alt Tab - , if you are familiar with Windows), what the title bars on - each window should look like, whether or not they have close buttons - on them, and so on. + , in the case of Microsoft Windows), what the title bars + on each window should look like, whether or not they have close + buttons on them, and so on. Instead, X delegates this responsibility to an application called - the Window Manager. There are dozens of window + a Window Manager. There are dozens of window managers available for X; AfterStep, + Blackbox, ctwm, Enlightenment, - ctwm, ftwm, - sawfish, twm, - WindowMaker and more. Each of these + fvwm, Sawfish, + twm, + Window Maker, and more. Each of these window managers provides a different look and feel; some of them - support virtual desktops some of them allow you to - completely customize the keystrokes you can use to manage your - desktop; some have a Start button, or similar device; - some are themeable, allowing you to completely change - the look-and-feel of your desktop by applying a new theme. These + support virtual desktops; some of them allow customized + keystrokes to manage the desktop; some have a Start + button or similar device; some are themeable, allowing + a complete change of look-and-feel by applying a new theme. These window managers, and many more, are available in the x11-wm category of the Ports Collection. In addition, the KDE and GNOME desktop environments both have - their own window managers which integrate tightly with the desktop, - although both of them allow you to replace the default window manager - with your own choice. + their own window managers which integrate with the desktop. Each window manager also has a different configuration mechanism; - some expect you to write a configuration file by hand; others feature - GUI tools for carrying most of the configuration tasks; at least one + some expect configuration file written by hand, others feature + GUI tools for most of the configuration tasks; at least one (sawfish) has a configuration file written - in a dialect of the Lisp language, which is very powerful (if you are - in to that sort of thing). - - As you can imagine, this flexibility comes with a price. It can - be very difficult for documents such as this one to guide you through - choosing and configuring a window manager because the available choice - is so wide. + in a dialect of the Lisp language. Focus Policy Another feature the window manager is responsible for is the - mouse focus policy. Each windowing system, be it X, - Microsoft Windows, or some other has an abstraction called the - focus, and at any one time only one window can have - the focus. The window that has the focus is the window that will - receive all your key presses and mouse clicks. - - You are probably familiar with a focus policy commonly called - click-to-focus. This means that you must click on - the window you want to have the focus. The window may then come to - the top of the stack, and all your key presses will now be directed - to this window, even if you move the mouse outside the window. To - give the focus to another window you must first click in it. + mouse focus policy. Every windowing system + needs some means of choosing a window to be actively receiving + keystrokes, and should visibly indicate which window is active as + well. + + A familiar focus policy is called click-to-focus. + This is the model utilized by Microsoft Windows, in which a window + becomes active upon receiving a mouse click. X does not support any particular focus policy. Instead, the window manager controls which window has the focus at any one time. Different window managers will support different focus methods. All of them support click to focus, and the majority of them support several others. - The two other most popular focus policies are: + The most popular focus policies are: focus-follows-mouse - With this policy, the window that is under the mouse - pointer is the window that has the focus. This may not - necessarily be the window that is on top of all the other - windows. You can change the focus by pointing at another - window, there is no need to click in it as well. - - After getting used to this policy it can be very - disorientating going back to another system that uses - click-to-focus. + The window that is under the mouse pointer is the + window that has the focus. This may not necessarily be + the window that is on top of all the other windows. + The focus is changed by pointing at another window, there + is no need to click in it as well. sloppy-focus This policy is a small extension to focus-follows-mouse. - With focus-follows-mouse, if you move the mouse over the - background (or desktop, also called the root window) then no - window has the focus, and your key presses go nowhere. + With focus-follows-mouse, if the mouse is moved over the + root window (or background) then no window has the focus, + and keystrokes are simply lost. With sloppy-focus, focus is + only changed when the cursor enters a new window, and not + when exiting the current window. + + + + + click-to-focus - If you use sloppy-focus and move the mouse pointer on the - root window then the last window that had the focus will keep - it. + + The active window is selected by mouse click. The + window may then be raised, and appear in + front of all other windows. All keystrokes will now be + directed to this window, even if the cursor is moved to + another window. - Your window manager will almost certainly support other - policies, and variations on these two, so make sure you read the - documentation it is supplied with. + Many window managers support other policies, as well as + variations on these. Be sure to consult the documentation for + the window manager itself. Widgets The X approach of providing tools and not policy extends to the - widgets that you see on screen in each application. + widgets that seen on screen in each application. - Widget is a GUI term for all the items in the user - interface that you can click on and manipulate in some way; buttons, - checkboxes, radio buttons, icons, lists, and so on. Microsoft Windows - Developer documentation calls these things - controls. + Widget is a term for all the items in the user + interface that can be clicked or manipulated in some way; buttons, + check boxes, radio buttons, icons, lists, and so on. Microsoft + Windows calls these controls. Microsoft Windows and Apple's MacOS both have a very rigid widget policy. Application developers are supposed to ensure that their - applications share a common look and feel. X was designed long before - either of these windowing systems, when research into GUI systems was - in its infancy, and it was felt that it would not be sensible to - mandate a particular graphical style, or set of widgets that have to - be adhered to. If you examine the evolution of the Windows or MacOS - GUI over the past ten years you will see many examples of how the - interfaces have been altered over time to reflect new thinking in the - art of Human/Computer Interaction. - - The upshot of this is that you can not expect X applications to - have a common look and feel. There are several popular widget sets - (and variations), including the original Athena widget set (developed - at MIT), Motif (on which the widget set in + applications share a common look and feel. With X, it was not + considered sensible to mandate a particular graphical style, or set + of widgets to adhere to. + + As a result, do not expect X applications to have a common + look and feel. There are several popular widget sets and + variations, including the original Athena widget set from MIT, + Motif (on which the widget set in Microsoft Windows was modeled, all bevelled edges and three shades of grey), OpenLook, and others. Most newer X applications today will use a modern-looking widget - set, probably either Qt, used by KDE, or + set, either Qt, used by KDE, or GTK, used by the GNOME - project. In this respect we are beginning to see a convergence in - look-and-feel on the Unix desktop, which certainly makes things easier - for the novice user. However, the sudden rise in popularity of - theming, allows users to confuse the issue once - more by dramatically altering the look and feel of desktop - widgets. + project. In this respect, there is some convergence in + look-and-feel of the Unix desktop, which certainly makes things + easier for the novice user. Installing XFree86 - Before installing XFree86 you must decide which version to + Before installing XFree86, decide on which version to run. XFree86 3.X is a maintenance branch of XFree86 development. It is very stable, and it supports a huge number of graphics cards. However, no new - development is happening there. XFree86 + development is being done on the software. XFree86 4.X is a complete redesign of the system with many new features such as better support for fonts and anti-aliasing. Unfortunately this new architecture requires that the video drivers be rewritten, and some of the older cards that were supported in 3.X are not yet supported in 4.X. - If your card is supported, then by all means run 4.X. The - FreeBSD setup program offers users the opportunity to install + The FreeBSD setup program offers users the opportunity to install and configure XFree86 3.3.6 during installation (covered in - ). If you would like to run - XFree86 4.X, then you should wait - until after the base FreeBSD system is installed and then - install XFree86. For example, to build and install - XFree86 4.X from the ports collection - : + ). To run + XFree86 4.X, wait until after the base + FreeBSD system is installed, and then install XFree86. For example, + to build and install XFree86 4.X from the + ports collection: &prompt.root; cd /usr/ports/x11/XFree86-4 &prompt.root; make all install clean Alternatively, XFree86 4.X can be installed from a binary package with the pkg_add tool or directly from the FreeBSD binaries provided on the XFree86 web site. + url="http://www.XFree86.org/">XFree86 web site. The rest of this chapter will explain how to configure - XFree86 for your hardware, and how to setup a productive - desktop environment. + XFree86, and how to setup a productive desktop environment. Christopher Shumway Contributed by XFree86 Configuration XFree86 4.X XFree86 - Before You Start + Before Starting - Before the user is to start configuration of - XFree86 4.X, the the following - information will need to be known about the target - system: + Before configuration of XFree86 4.X, + the the following information about the target system is needed: Monitor specifications Video Adapter chipset Video Adapter memory horizontal scan rate vertical scan rate - The specifications for the target system's monitor are - used by XFree86 to determine the - resolution and refresh rate to run at. These specifications can - usually be obtained from the documentation that came with the - target system's monitor or from the manufacturer's website. - There are two ranges of numbers that are needed, the horizontal - scan rate and the vertical synchronization rate. + The specifications for the monitor are used by + XFree86 to determine the resolution and + refresh rate to run at. These specifications can usually be + obtained from the documentation that came with the monitor or from + the manufacturer's website. There are two ranges of numbers that + are needed, the horizontal scan rate and the vertical synchronization + rate. The video adapter's chipset defines what driver module XFree86 uses to talk to the graphics hardware. With most chipsets, this can be automatically determined, but it is still useful to know in case the automatic detection does not work correctly. Video memory on the graphic adapter determines the - resolution and color depth the target system can run at. This - is important to know so the user knows the limitations of the - target system. + resolution and color depth the system can run at. This is + important to know so the user knows the limitations of the + system. Configuring XFree86 4.X Configuration of XFree86 4.X is a multi-step process. The first step is to build an initial configuration file with the option to XFree86. As the super user, simply run: &prompt.root; XFree86 -configure This will generate a skeleton XFree86 configuration file in the current working directory called XF86Config.new. The XFree86 program will attempt to probe the graphics hardware on the system and will write a configuration file to load the proper drivers for the detected hardware on the target system. The next step is to test the existing configuration to verify that XFree86 can work with the graphics hardware on the target system. To preform this task, the user needs to run: &prompt.root; XFree86 -xf86config XF86Config.new - If the user is presented with a black and grey grid and an - X mouse cursor, then the configuration was successful. To - exit the test, just press + If a black and grey grid and an X mouse cursor appears, then + the configuration was successful. To exit the test, just press + Ctrl Alt Backspace simultaneously. XFree86 4 Tuning - Next, the user needs to tune the - XF86Config.new configuration file to their - personal taste. Open up the file in a text editor such as - &man.emacs.1; or &man.ee.1;. The first thing the user will want to - do is add the frequencies for the target system's monitor. - These are usually expressed as a horizontal and vertical - synchronization rate. These values are added to the - XF86Config.new file under the "Monitor" - section as such: + Next, tune the XF86Config.new + configuration file to taste. Open up the file in a text editor such + as &man.emacs.1; or &man.ee.1;. The first thing to do is add the + frequencies for the target system's monitor. These are usually + expressed as a horizontal and vertical synchronization rate. These + values are added to the XF86Config.new file + under the "Monitor" section: Section "Monitor" Identifier "Monitor0" VendorName "Monitor Vendor" ModelName "Monitor Model" Horizsync 30-107 VertRefresh 48-120 EndSection The Horizsync and VertRefresh keywords may not exist in the - user's configuration file. If they do not, they need to be - added, with the correct horizontal synchronization rate placed - after the Horizsync keyword and the vertical + configuration file. If they do not, they need to be added, with + the correct horizontal synchronization rate placed after the + Horizsync keyword and the vertical synchronization rate after the VertRefresh keyword. In the example above the target monitor's rates where entered. XF86Config While the XF86Config.new - configuration file is still open in an editor, next the user - needs to select what the default resolution and color depth is - desired. This is defined in the Screen - section. + configuration file is still open in an editor, next select what + the default resolution and color depth is desired. This is + defined in the Screen section: Section "Screen" Identifier "Screen0" Device "Card0" Monitor "Monitor0" DefaultColorDepth 24 SubSection "Display" Depth 24 Modes "1024x768" EndSubSection EndSection The DefaultColorDepth keyword describes - the color depth the user wishes to run at by default. This can - be overridden with the -bpp command line - switch to XFree86 - 1. The Modes keyword describes the - resolution the user wishes to run at for the given color depth. + the color depth to run at by default. This can be overridden + with the -bpp command line switch to + XFree86 + 1. The Modes keyword + describes the resolution to run at for the given color depth. In the example above, the default color depth is twenty four bits per pixel. At this color depth, the accepted resolution is one thousand twenty four pixels by seven hundred and sixty eight pixels. - If a user wants to run at a resolution of one thousand - twenty four pixels by seven hundred sixty eight pixels at twenty - four bits per pixel, then the user needs to add the - DefaultColorDepth keyword with the value of - twenty four, and add to the "Display" + To run at a resolution of one thousand twenty four pixels by + seven hundred sixty eight pixels at twenty four bits per pixel, + then add the DefaultColorDepth keyword with the + value of twenty four, and add to the "Display" subsection with the desired Depth the Modes keyword with the resolution the user wishes to run at. Note that only VESA standard modes are supported as defined by the target system's graphics hardware. - Finally, the user can write out the configuration file and - test it using the test mode given above. If all is well, then - the configuration file needs to be installed in a common - location where XFree86 - 1 can source it in the future. + Finally, write out the configuration file and test it using + the test mode given above. If all is well, then the configuration + file needs to be installed in a common location where + XFree86 + 1 can find it. This is typically /etc/X11/XF86Config or /usr/X11R6/etc/X11/XF86Config. &prompt.root; cp XF86Config.new /etc/X11/XF86Config Once the configuration file has been placed in a common - location, XFree86 can then be used through &man.xdm.1;. In - order to use startx - 1 the user will have to install - the X11/wrapper port. + location, configuration is complete. In order to start + XFree86 4.X with &man.startx.1;, + install the x11/wrapper port. + XFree86 4.X can also be started with + &man.xdm.1;. Advanced Configuration Topics Configuration with Intel i810 Graphics Chipsets Intel i810 graphic chipset Configuration with Intel i810 integrated chipsets - requires the agpgart AGP programming interface for - XFree86 to be able to drive the - card. To enable the agpgart programming - interface, the agp.ko kernel loadable - module needs to be loaded into the kernel with - &man.kldload.8;. This can be done automatically with the - &man.loader.8;. Simply add this line to - /boot/loader.conf to have the loader load - agp.ko at boot time: + requires the agpgart + AGP programming interface for XFree86 + to to drive the card. To agpgart, + the agp.ko kernel loadable module needs to + be loaded into the kernel with &man.kldload.8;. This can be + done automatically with the &man.loader.8; at boot time. + Simply add this line to + /boot/loader.conf: agp_load="YES" Next, a device node needs to be created for the programming interface. To create the AGP device node, run - &man.MAKEDEV.8; in the /dev directory as - such: + &man.MAKEDEV.8; in the /dev + directory: &prompt.root; cd /dev &prompt.root; sh MAKEDEV agpgart - This will allow the user to configure the graphics - hardware as any other graphics board. + This will allow configuration the hardware as any other + graphics board. Murray Stokely Contributed by Using Fonts in XFree86 Type1 Fonts The default fonts that ship with XFree86 are less than ideal for typical desktop publishing applications. Large presentation fonts show up - jagged and unprofessional looking and small fonts in Netscape are + jagged and unprofessional looking, and small fonts in Netscape are almost completely unintelligible. However, there are several free, high quality Type1 (PostScript) fonts available which can be readily used with XFree86, either version 3.X or version 4.X. For instance, the URW font collection (x11-fonts/urwfonts) includes high quality versions of standard type1 fonts (Times Roman, Helvetica, Palatino and others). The Freefont collection (x11-fonts/freefont) includes many more fonts, but most of them are intended for use in graphics software such as the Gimp, and are not complete enough to serve as screen fonts. In addition, XFree86 can be configured to use TrueType fonts with a minimum of effort: see the section on TrueType fonts later. To install the above Type1 font collections from the ports - collection you can run the following commands. + collection, run the following commands: &prompt.root; cd /usr/ports/x11-fonts/urwfonts &prompt.root; make install clean And likewise with the freefont or other collections. To tell the X server - that these fonts exist, you can add an appropriate line - to your XF86Config file (in + that these fonts exist, add an appropriate line to the + XF86Config file (in /etc/ for XFree86 version 3, or in /etc/X11/ for version 4), which reads: FontPath "/usr/X11R6/lib/X11/fonts/URW/" - Alternatively, at the command line in your X session you can - write: + Alternatively, at the command line in the X session + run: &prompt.user; xset fp+ /usr/X11R6/lib/X11/fonts/URW &prompt.user; xset fp rehash - This will work but will be lost when you log out from this - session, unless you add it to your startup file - (~/.xinitrc for a normal - startx session, + This will work but will be lost when the X session is closed, + unless it is added to the startup file (~/.xinitrc + for a normal startx session, or ~/.xsession when logging in through a graphical login manager like XDM). A third way is to use the new XftConfig file: see the - section on anti-aliasing, later. + section on anti-aliasing. TrueType Fonts - XFree86 4.0 has built in support + XFree86 4.X has built in support for rendering TrueType fonts. There are two different modules that can enable this functionality. The "freetype" module is used in this example because it is more consistent with the other font - rendering back-ends. To enable the freetype module just add the - following line to the module section of your + rendering back-ends. To enable the freetype module just add the + following line to the module section of the /etc/X11/XF86Config file. Load "freetype" - For XFree86 3.3.X you will need - to run a separate TrueType font - server. Xfstt is commonly used for - this purpose. To install x11-servers/Xfstt on - your FreeBSD system simply install the port from - /usr/ports/x11-servers/Xfstt - - You should now make a directory for your TrueType fonts - (For example, /usr/X11R6/lib/X11/fonts/TrueType) - and copy all of your TrueType fonts into this directory. Keep in - mind that you cannot take TrueType fonts directly from a + For XFree86 3.3.X, a separate + TrueType font server is needed. + Xfstt is commonly used for + this purpose. To install Xfstt, + simply install the port x11-servers/Xfstt. + + Now make a directory for the TrueType fonts (for example, + /usr/X11R6/lib/X11/fonts/TrueType) + and copy all of the TrueType fonts into this directory. Keep in + mind that TrueType fonts cannot be directly taken from a Macintosh; they must be in Unix/DOS/Windows format for use by - XFree86. Once you have copied the - files into this directory you need to use + XFree86. Once the files have been + copied into this directory, use ttmkfdir to create a - fonts.dir file so that the X font renderer - knows that you have installed these new - files. ttmkfdir is available from the FreeBSD + fonts.dir file, so that the X font renderer + knows that these new files have been installed. + ttmkfdir is available from the FreeBSD Ports Collection as x11-fonts/ttmkfdir. &prompt.root; cd /usr/X11R6/lib/X11/fonts/TrueType &prompt.root; ttmkfdir > fonts.dir - Now you need to add your TrueType directory to your fonts - path. This is just the same as described above for Now add the TrueType directory to the font + path. This is just the same as described above for Type1 fonts, that is, use &prompt.user; xset fp+ /usr/X11R6/lib/X11/fonts/TrueType &prompt.user; xset fp rehash or add a line to the XF86Config file. - That's it. Now Netscape, + That's it. Now Netscape, Gimp, - StarOffice, and all of your other X - applications should now recognize your installed TrueType - fonts. Extremely small fonts (as with text in a high resolution + StarOffice, and all of the other X + applications should now recognize the installed TrueType + fonts. Extremely small fonts (as with text in a high resolution display on a web page) and extremely large fonts (within StarOffice) will look much better now. - Anti-Aliasing Your Fonts + Anti-Aliased Fonts Starting with version 4.0.2, XFree86 supports anti-aliased fonts. Currently, most software has not been updated to take advantage of this new functionality. However, Qt (the toolkit - for the KDE desktop) does; so if you - are running XFree86 4.0.2 + for the KDE desktop) does; so if + XFree86 4.0.2 is used (or higher), Qt 2.3 (or higher) and KDE, - all your KDE/Qt applications can be made to use anti-aliased + all KDE/Qt applications can be made to use anti-aliased fonts. - To configure anti-aliasing, you need to create (or edit, if + To configure anti-aliasing, create (or edit, if it already exists) the file /usr/X11R6/lib/X11/XftConfig. Several advanced things can be done with this file; this section describes only the simplest possibilities. - First, you need to tell the X server about the fonts which you - want anti-aliased. For each font directory, add a line similar + First, tell the X server about the fonts that are to be + anti-aliased. For each font directory, add a line similar to this: dir "/usr/X11R6/lib/X11/Type1" - And likewise for the other font directories (URW, truetype, etc) - containing fonts you would like anti-aliased. Anti-aliasing makes + Likewise for the other font directories (URW, truetype, etc) + containing fonts to be anti-aliased. Anti-aliasing makes sense only for scalable fonts (basically, Type1 and TrueType) so do not include bitmap font directories here. The - directories which you included here can now be commented out - of your XF86Config file. - - Next, you may not want to anti-alias normal-sized text. - (Antialiasing makes borders slightly fuzzy, which makes very - small text more readable and removes "staircases" from large text, - but can cause eyestrain if applied to normal text.) To exclude - point sizes between 9 and 13 from anti-aliasing, include these - lines: + directories included here can now be commented out + of the XF86Config file. + + Antialiasing makes borders slightly fuzzy, which makes very + small text more readable and removes staircases from + large text, but can cause eyestrain if applied to normal text. To + exclude point sizes between 9 and 13 from anti-aliasing, include + these lines: match any size > 8 any size < 14 edit antialias = false; - You may also find that the spacing for some monospaced fonts - gets messed up when you turn on anti-aliasing. This seems to - be an issue with KDE, in particular. - One possible fix for this - is to force the spacing for such fonts to be 100: add the - following lines: + Spacing for some monospaced fonts may also be inappropriate + with anti-aliasing. This seems to be an issue with + KDE, in particular. One possible fix for + this is to force the spacing for such fonts to be 100. Add the + following lines: match any family == "fixed" edit family =+ "mono"; match any family == "console" edit family =+ "mono"; (this aliases the other common names for fixed fonts as "mono"), and then add: match any family == "mono" edit spacing = 100; - Supposing you want to use the - Lucidux fonts whenever + Supposing the + Lucidux fonts as desired whenever monospaced fonts are required (these look nice, and do not seem - to suffer from the spacing problem), you could replace that last + to suffer from the spacing problem), replace that last line with these: match any family == "mono" edit family += "LuciduxMono"; match any family == "Lucidux Mono" edit family += "LuciduxMono"; match any family == "LuciduxMono" edit family =+ "Lucidux Mono"; (the last lines alias different equivalent family names). - Finally, you want to allow users to add commands to this + Finally, it is nice to allow users to add commands to this file, via their personal .xftconfig files. To do this, add a last line: includeif "~/.xftconfig" - One last point: if you are using an LCD screen, you may - want to enable sub-pixel sampling. This basically treats the - (horizontally separated) red, green and blue components - separately to improve the horizontal resolution; the results can - be dramatic. To enable this, add the line somewhere in your - XftConfig file + One last point: with an LCD screen, sub-pixel sampling may be + desired. This basically treats the (horizontally separated) + red, green and blue components separately to improve the horizontal + resolution; the results can be dramatic. To enable this, add the + line somewhere in the XftConfig file match edit rgba=rgb; - (depending on what sort of display you have, you may - need to change that last word from ``rgb'' to ``bgr'', ``vrgb'' + (depending on the sort of display, the last word may need to + be changed from from ``rgb'' to ``bgr'', ``vrgb'' or ``vbgr'': experiment and see which works best.) - That's all; anti-aliasing should be enabled the next - time you start the X server. However, note that your programs must - know how to take advantage of it. At the present time, the toolkit + Anti-aliasing should be enabled the next time the X server is + started. However, note that programs must know how to take + advantage of it. At the present time, the toolkit Qt does, so the entire KDE environment can use anti-aliased fonts (see on KDE for details); there are patches for gtk+ to do the same, so if compiled against such a patched gtk+, the GNOME environment and Mozilla can also use anti-aliased fonts. In fact, there - is now a library called gdkxft (in the ports) which allows one + is now a port called x11/gdkxft which allows one to use antialiased fonts without recompiling: see for details. Anti-aliasing is still new to FreeBSD and XFree86; configuring it should get easier with time, and it will soon be supported by many more applications. Seth Kingsley Contributed by The X Display Manager Overview The X Display Manager (XDM) is an optional part of the X Window System that is used for login - session management. This is useful for several types of + session management. This is useful for several types of situations, including minimal X Terminals, desktops, and large network display - servers. Since the X Window System is network and protocol + servers. Since the X Window System is network and protocol independent, there are a wide variety of possible configurations for running X clients and servers on different machines - connected by a network. XDM provides + connected by a network. XDM provides a graphical interface for choosing which display server to connect to, and entering authorization information such as a login and password combination. - You may think of XDM as + Think of XDM as providing the same functionality to the user as the &man.getty.8; utility (see for - details). That is, it performs system logins to the display + details). That is, it performs system logins to the display being connected to and then runs a session manager on behalf of the user (usually an X window - manager). XDM then waits for this + manager). XDM then waits for this program to exit, signaling that the user is done and should be - logged out of the display. At this point, + logged out of the display. At this point, XDM can display the login and display chooser screens for the next user to login. Using XDM The XDM daemon program is - located in /usr/X11R6/bin/xdm. You can run - this program at any time as root and it will start managing the - X display on the local machine. If you want - XDM to run in the background every + located in /usr/X11R6/bin/xdm. This program + can be run at any time as root and it will + start managing the X display on the local machine. If + XDM is to be run every time the machine boots up, a convenient way to do this is by adding an entry to /etc/ttys. For more information about the format and usage of this file, see . There is a line in the default + linkend="term-etcttys">. There is a line in the default /etc/ttys file for running the XDM daemon on a virtual terminal: ttyv8 "/usr/X11R6/bin/xdm -nodaemon" xterm off secure - By default this entry is disabled, and in order to enable it you - will need to change field 5 from off to + By default this entry is disabled, and in order to enable it + change field 5 from off to on and then restart &man.init.8; using the - directions in . The first field, the + directions in . The first field, the name of the terminal this program will manage, is - ttyv8. This means that XDM - will start running on the 9th virtual terminal. + ttyv8. This means that + XDM will start running on the 9th + virtual terminal. Configuring XDM The XDM configuration directory - is located in /usr/X11R6/lib/X11/xdm. In - this directory you will see several files used to change the + is located in /usr/X11R6/lib/X11/xdm. In + this directory there are several files used to change the behavior and appearance of - XDM. Typically you will find these - files: + XDM. Typically these files will + be found: File Description Xaccess Client authorization ruleset. Xresources Default X resource values. Xservers List of remote and local displays to manage. Xsession Default session script for logins. Xsetup_* Script to launch applications before the login interface. xdm-config Global configuration for all displays running on this machine. xdm-errors Errors generated by the server program. xdm-pid The process ID of the currently running XDM. Also in this directory are a few scripts and programs used to setup the desktop when XDM is - running. In the next few sections I will briefly describe the - purpose of each of these files. The exact syntax and usage of - all of these files is described in &man.xdm.1; + running. The purpose of each of these files will be briefly + described. The exact syntax and usage of all of these files is + described in &man.xdm.1; The default configuration is a simple rectangular login window with the hostname of the machine displayed at the top in a large font and Login: and - Password: prompts below. This is a good starting - point if you are planning to design your own look and feel for - the XDM screens. + Password: prompts below. This is a good starting + point for changing the look and feel of + XDM screens. Xaccess The protocol for connecting to XDM controlled displays is called - the X Display Manager Connection Protocol (XDMCP). This file - is basically just a ruleset for controlling XDMCP connections - from remote machines. By default, it allows any client to - connect, but you will see this will not matter because the - default xdm-config file does not listen - for remote connections. + the X Display Manager Connection Protocol (XDMCP). This file + is a ruleset for controlling XDMCP connections from remote + machines. By default, it allows any client to connect, but + that does not matter unless the xdm-config + is changed to listen for for remote connections. Xresources This is an application-defaults file for the display - chooser and the login screens. This is where you can customize - the appearance of the login program. The format is identical - to the app-defaults file described in the XFree86 - documentation. + chooser and the login screens. This is where the appearance + of the login program can be modified. The format is identical + to the app-defaults file described in the + XFree86 documentation. Xservers This is a list of the remote displays the chooser should provide as choices. Xsession This is the default session script for XDM to run after a user has logged - in. Normally each user will have a customized session script + in. Normally each user will have a customized session script in ~/.xsessionrc that overrides this script. Xsetup_* - These files contain scripts that will be run automatically - before displaying the chooser or login interfaces. There is a - script for each display being used, named - Xsetup_ followed by the local display - number (for instance Xsetup_0). Typically - these scripts will run one or two programs in the background - such as xconsole. + These will be run automatically before displaying the + chooser or login interfaces. There is a script for each + display being used, named Xsetup_ followed + by the local display number (for instance + Xsetup_0). Typically these scripts will + run one or two programs in the background such as + xconsole. xdm-config - This file contains settings in the form of app-defaults + This contains settings in the form of app-defaults that are applicable to every display that this installation manages. xdm-errors - This file contains the output of the X servers that - XDM is trying to run. If a display + This contains the output of the X servers that + XDM is trying to run. If a display that XDM is trying to start hangs for some reason, this is a good place to look for error - messages. These messages are also written to the user's + messages. These messages are also written to the user's ~/.xsession-errors file on a per-session - basis + basis. Running a Network Display Server - In order for other clients to connect to your display - server, you will need to edit the access control rules, and - enable the connection listener. By default these are set to - conservative values, which is a good decision security-wise. To - get XDM to listen for connections + In order for other clients to connect to the display + server, edit the access control rules, and enable the connection + listener. By default these are set to conservative values. + To make XDM listen for connections, first comment out a line in the xdm-config file: ! SECURITY: do not listen for XDMCP or Chooser requests ! Comment out this line if you want to manage X terminals with xdm DisplayManager.requestPort: 0 - and then restart XDM. Remember that + and then restart XDM. Remember that comments in app-defaults files begin with a ! - character, not the usual #. After this, you may need to - put more strict access controls in place. Look at the example + character, not the usual #. More strict + access controls may be desired. Look at the example entries in Xaccess file, and refer to the &man.xdm.1; manual page. Replacements for XDM Several replacements for the default XDM program exist. One of them, KDM (bundled with KDE) is described later in this chapter. KDM offers many visual improvements and cosmetic frills, as well as the functionality to allow users to choose their window manager of choice at login time. - - Valentino Vaschetto Contributed by Desktop Environments This section describes the different desktop environments - available for X on FreeBSD. For our purposes a "desktop - environment" will mean anything ranging from a simple window - manager, to a complete suite of desktop applications such as + available for X on FreeBSD. A desktop environment + will mean anything ranging from a simple window manager, to a + complete suite of desktop applications such as KDE or GNOME. GNOME About GNOME GNOME is a user-friendly desktop environment that enables users to easily use and configure their computers. GNOME includes a panel (for starting applications and displaying status), a desktop (where data and applications can be placed), a set of standard desktop tools and applications, and a set of conventions that make it easy for applications to - cooperate and be consistent with each other. Users of other + cooperate and be consistent with each other. Users of other operating systems or environments should feel right at home using the powerful graphics-driven environment that GNOME provides. - + Installing GNOME The easiest way to install GNOME is through the Desktop Configuration menu during the FreeBSD - installation process as described in Chapter 2. If for some - reason you didn't install a desktop environment at that - time, then you can easily install one from the package or - ports collections. + installation process as described in Chapter 2. They can also + be easily installed from a package or the ports + collection: To install the GNOME package from the network, simply type: &prompt.root; pkg_add -r gnome - If you would rather build - GNOME from source, then use the - ports tree: + To build GNOME from source, use + the ports tree: &prompt.root; cd /usr/ports/x11/gnome &prompt.root; make install clean - Once GNOME is installed, we - must have the X server start GNOME - instead of a default window manager. If you have already - customized your .xinitrc file then you - should simply replace the line that starts your current window + Once GNOME is installed, + the X server must be told to start + GNOME instead of a default window + manager. If a custom .xinitrc is already in + place, simply replace the line that starts the current window manager with one that starts - /usr/X11R6/bin/gnome-session instead. If you - have not added anything special to your configuration file, + /usr/X11R6/bin/gnome-session instead. + If nothing special has been done to configuration file, then it is enough to simply type: &prompt.root; echo "/usr/X11R6/bin/gnome-session" > ~/.xinitrc - That's it. Type startx and you will be in the - GNOME desktop environment. + Next, type startx, and the + GNOME desktop environment will be + started. - If you are running a display manager like - XDM, this will not work. Instead, - you should create an executable .xsession - file with the same command in it. To do this, edit your file - (if you already have one) and replace the existing - window manager command with - /usr/X11R6/bin/gnome-session; or else, + If a display manager, like + XDM, is being used, this will not work. + Instead, create an executable .xsession + file with the same command in it. To do this, edit the file + and replace the existing window manager command with + /usr/X11R6/bin/gnome-session: + &prompt.root; echo "#!/bin/sh" > ~/.xsession &prompt.root; echo "/usr/X11R6/bin/gnome-session" >> ~/.xsession &prompt.root; chmod +x ~/.xsession - Another option is to configure your display manager to + Another option is to configure the display manager to allow choosing the window manager at login time; the section on KDE2 details explains how to do this for kdm, the display manager of KDE. Anti-aliased fonts with GNOME While anti-aliased fonts made their first appearance on XFree86 desktops in the KDE environment and are supported there in the standard installation, it is also possible to use them with gtk applications such as the GNOME environment. The most straightforward way is probably by using the libgdkxft library, in the x11/gdkxft port. After installing this - port, read carefully the + port, read the /usr/X11R6/share/doc/gdkxft/README file carefully. - If you already have a working - XftConfig file, all you really need to - do is tell your gtk applications to look for their - font-rendering functions in + Then, all that is needed is to do is tell gtk + applications to look for their font-rendering functions in libgdkxft.so before looking in the standard place, libgdk.so. This is easily accomplished by setting an environment variable to point to the right place; with the Bourne shell (/bin/sh) or similar shells, type the command (to start The Gimp, say) &prompt.user; LD_PRELOAD=/usr/X11R6/lib/libgdkxft.so gimp and with csh and similar shells, type &prompt.user; setenv LD_PRELOAD /usr/X11R6/lib/libgdkxft.so &prompt.user; gimp - It is a nuisance to do this all the time, so you can - simply put the commands + Or, the commands LD_PRELOAD=/usr/X11R6/lib/libgdkxft.so export LD_PRELOAD - into your .xinitrc, + can be put into .xinitrc, .xsession or in the appropriate place(s) in /usr/X11R6/lib/X11/xdm/Xsession, - depending on how you normally start X. However, this - short-cut may cause you problems if you want to run Linux - gtk binaries. + depending on how X is normally started. However, this + short-cut may cause problems if Linux GTK binaries are + run. KDE2 About KDE2 KDE is an easy to use contemporary desktop environment. Some of the things that KDE brings to the user are: A beautiful contemporary desktop A desktop exhibiting complete network transparency An integrated help system allowing for convenient, consistent access to help on the use of the KDE desktop and its applications Consistent look and feel of all KDE applications Standardized menu and toolbars, keybindings, color-schemes, etc. Internationalization: KDE is available in more than 40 languages Centralized consisted dialog driven desktop configuration A great number of useful KDE applications KDE has an office application suite based on KDE's KParts technology consisting of a spread-sheet, a presentation application, an organizer, a - news client and more. KDE also + news client and more. KDE also comes with a web browser called Konqeuror, which represents a solid competitor to other existing web browsers on Unix - systems. More information on KDE - can be found on the KDE - website - + systems. More information on KDE + can be found on the KDE + website. + Installing KDE2 Just like with GNOME or any other desktop environment, the easiest way to install KDE is through the Desktop Configuration menu during the FreeBSD installation - process as described in Chapter 2. If for some reason you - didn't install a desktop environment at that time, then you - can easily install one from the package or ports - collections. + process as described in Chapter 2. Once again, the software + can be easily installed from a package or from the ports + collection: To install the KDE2 package from the network, simply type: &prompt.root; pkg_add -r kde2 - If you would rather build - KDE from source, then use the - ports tree: + To build KDE from source, + use the ports tree: &prompt.root; cd /usr/ports/x11/kde2 &prompt.root; make install clean - After you've installed KDE2, - you must tell the X server to launch this application + After KDE2 has been installed, + the X server must be told to launch this application instead of the default window manager. This is accomplished - by editing the .xinitrc file in your - home directory : + by editing the .xinitrc file: &prompt.root; echo "/usr/X11R6/bin/startkde" > ~/.xinitrc Now, whenever invoke X-Windows with startx, - KDE2 will be your - desktop. + KDE2 will be the desktop. - If you are using a display manager such as - xdm, then configuration is - slightly different. You must edit the + If a display manager such as + xdm is being used, then + configuration is slightly different. Edit the .xsession file instead. Instructions for kdm are described later in this chapter. - + More Details on KDE2 Now that KDE2 is installed on - your system, you will find that you can learn a lot from its + the system, most things can be discovered through the help pages, or just by pointing and clicking at various menus. Windows or Mac users will feel quite at home. The best reference for KDE is the on-line documentation. KDE comes with its own web browser, Konqueror, dozens of useful applications, and extensive documentation. The remainder of this section discusses the technical items that are difficult to learn by random exploration. The KDE display manager - If you are an administrator on a multi-user system, you - may like to have a graphical login screen to welcome users. - You can use xdm, as described - earlier. However, KDE includes an + An administrator of a multi-user system may wish to have + a graphical login screen to welcome users. + xdm can be + used, as described earlier. However, + KDE includes an alternative, KDM, which is designed to look more attractive and include more login-time options. In particular, users can easily choose (via a menu) which desktop environment (KDE2, GNOME, or something else) to run - after logging on. If you are slightly adventurous and you want - this added flexibility and visual appeal, read on. + after logging on. To begin with, run the KDE2 control panel, kcontrol, as root. It is generally considered - unsafe to run your entire X environment as - root. Instead, run your window manager + unsafe to run the entire X environment as + root. Instead, run the window manager as a normal user, open a terminal window (such as xterm or KDE's konsole, become root - with su (you need to be in the + with su (the user must be in the wheel group in /etc/group for this), and then type kcontrol. Click on the icon on the left marked System, then on - Login manager. On the right you will see various configurable - options, which the KDE manual will - explain in greater detail. Click on sessions on the right. - Depending on what window managers or desktop environments you - have currently installed, you can type their names in New - type and add them. (These are just labels so far, not - commands, so you can write KDE and + Login manager. On the right there are + various configurable options, which the + KDE manual will explain in greater + detail. Click on sessions on the right. + Click New type to add various window + managers and desktop environments. These are just labels, + so they can say KDE and GNOME rather than - startkde or gnome-session.) + startkde or + gnome-session. Include a label failsafe. - Play with the other menus as you like (those are mainly - cosmetic and self-explanatory). When you are done, click on - Apply at the bottom, and quit the control center. + Play with the other menus as well, they are mainly + cosmetic and self-explanatory. When are done, click on + Apply at the bottom, and quit the + control center. To make sure kdm understands - what your above labels (KDE, - GNOME etc) mean, you need to edit - some more files: the same ones used by xdm. + what the labels (KDE, + GNOME etc) mean, edit the files used + by xdm. In KDE 2.2 this has changed: kdm now uses its own configuration files. Please see the KDE 2.2 documentation for details. - In your terminal window, as root, + In a terminal window, as root, edit the file - /usr/X11R6/lib/X11/xdm/Xsession. You - will come across a section in the middle looking like this (by - default): + /usr/X11R6/lib/X11/xdm/Xsession. There is + a section in the middle like this: case $# in 1) case $1 in failsafe) exec xterm -geometry 80x24-0-0 ;; esac esac - You will need to add a few lines to this section. - Assuming the labels you gave earlier were KDE2 and GNOME, - the following will do: + A few lines need to be added to this section. + Assuming the labels from used were KDE2 and + GNOME, + use the following: case $# in 1) case $1 in KDE2) exec /usr/X11R6/bin/startkde ;; GNOME) exec /usr/X11R6/bin/gnome-session ;; failsafe) exec xterm -geometry 80x24-0-0 ;; esac esac - To make sure your KDE choice - of a login-time desktop background is also honored, you will - need to add the following line to + For the KDE + login-time desktop background to be honored, + the following line needs to be added to /usr/X11R6/lib/X11/xdm/Xsetup_0: /usr/X11R6/bin/kdmdesktop - Now, you need only to make sure that - kdm is listed in + Now, make sure kdm is listed in /etc/ttys to be started at the next bootup. To do this, simply follow the instructions from the previous section on xdm and replace references to the /usr/X11R6/bin/xdm program with /usr/local/bin/kdm. - - That's it. Your next login screen should have a pretty - face and lots of menus. - + Anti-aliased Fonts Starting with version 4.0.2, XFree86 supports anti-aliasing via its "RENDER" extension, and starting with version 2.3, Qt (the toolkit used by KDE) supports this extension. Configuring this is described in on antialiasing X11 fonts. So if you are - running up-to-date software, anti-aliasing is possible on your - KDE2 desktop. Just go to your KDE2 + linkend="antialias"> on antialiasing X11 fonts. So, with + up-to-date software, anti-aliasing is possible on a + KDE2 desktop. Just go to the KDE2 menu, go to Preferences -> Look and Feel -> Style, and click - on the checkbox "Use Anti-Aliasing for Fonts and Icons". - That's all. If you are running a Qt application which is not - part of KDE, you may need to set - the environment variable QT_XFT to true before starting your - program. + on the check box + Use Anti-Aliasing for Fonts and Icons. + For a Qt application which is not part of + KDE, the environment variable QT_XFT + needs to be set to true before starting the program. XFCE About XFCE XFCE is a desktop environment - based on the gtk+ + based on the GTK toolkit used by GNOME, but is much more lightweight and meant for those who want a simple, efficient desktop which is nevertheless easy to use and configure. Visually, it looks very much like CDE, found on commercial Unix systems. Some of XFCE's features are: A simple, easy-to-handle desktop Fully configurable via mouse, with drag and drop, etc Main panel similar to CDE, with menus, applets and app launchers Integrated window manager, file manager, sound manager, GNOME compliance module, and other things - Themeable (since it uses gtk+) + Themeable (since it uses GTK) Fast, light and efficient: ideal for older/slower machines or machines with memory limitations More information on XFCE - can be found on the XFCE + can be found on the XFCE website. Installing XFCE A binary package for xfce - exists (at the time of writing). To install, simply do - this: + exists (at the time of writing). To install, simply type: - &prompt.root; pkg_add -r xfce + &prompt.root; pkg_add -r xfce - Alternatively, you may prefer to build from source. - The ports tree comes to the rescue again: + Alternatively, to build from source, use the ports + collection: - &prompt.root; cd /usr/ports/x11-wm/xfce + &prompt.root; cd /usr/ports/x11-wm/xfce &prompt.root; make install clean - All necessary source packages (including dependencies) - will be automagically fetched, built and installed, and - the build areas cleaned up afterwards. - - Now you want to tell the X server to launch - XFCE the next time you start - X. Simply type this: - - &prompt.root; echo "/usr/X11R6/bin/startxfce" > ~/.xinitrc - - The next time you start X, XFCE will be your - desktop. (Note, as before: - if you are logging in via a display manager like - xdm, you should either create an - .xsession, as described in the - section on GNOME, but - with the /usr/X11R6/bin/startxfce - command; or, configure your display manager to allow - choosing a desktop at login time, as explained in - the section on kdm.) + Now, tell the X server to launch + XFCE the next time X is started. + Simply type this: + + &prompt.root; echo "/usr/X11R6/bin/startxfce" > ~/.xinitrc + + The next time X is started, + XFCE will be the desktop. + As before, if a display manager like + xdm is being used, create an + .xsession, as described in the + section on GNOME, but + with the /usr/X11R6/bin/startxfce + command; or, configure the display manager to allow + choosing a desktop at login time, as explained in + the section on kdm.