7a9467b53e3a367df62100f2062f9c348e97241f
[ikiwiki.git] / docs / newhandbook / X / index.mdwn
1 # The X Window System 
2 ***Updated for X.Org's X11 server by Ken Tom and Marc Fonvieille. Updated for DragonFly by Victor Balada Diaz.***
3
4 [[!toc  levels=3]]
5
6
7 ## Synopsis 
8
9 DragonFly uses X11 to provide users with a powerful graphical user interface. X11 is an open-source implementation of the X Window System that includes both  **X.org**  and  **XFree86™** . DragonFly default official flavor is  **X.org** , the X11 server developed by the X.Org Foundation. This chapter will cover the installation and configuration of X11 with emphasis on  **X.org** . For more information on the video hardware that X11 supports, check either the [X.org](http://www.x.org/) or [XFree86](http://www.XFree86.org/) web sites.
10
11
12
13 After reading this chapter, you will know:
14
15
16
17
18 * The various components of the X Window System, and how they interoperate.
19 * How to install and configure X11.
20 * How to install and use different window managers.
21 * How to use True***Type® fonts in X11.
22 * How to set up your system for graphical logins ( **XDM** ).
23
24
25
26 Before reading this chapter, you should:
27
28 * Know how to install additional third-party software. Compare the pkgsrc chapter of the handbook.
29
30 **Note:** This chapter covers the installation and the configuration of both  **X.org**  and  **XFree86**  X11 servers. For the most part, configuration files, commands and syntaxes are identical. In the case where there are differences, both  **X.org**  and  **XFree86**  syntaxes will be shown.
31
32
33
34
35
36
37 ## Understanding X 
38
39 ### The Window Manager 
40
41
42
43 The X design philosophy is much like the UNIX design philosophy, ***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 to move them around with the mouse, what keystrokes should be used to move between windows (i.e.,  **Alt** + **Tab** , 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.
44
45
46
47 Instead, X delegates this responsibility to an application called a ***Window Manager***. There are dozens of window managers available for X: ***'After***Step***',  **Blackbox** ,  **ctwm** ,  **Enlightenment** ,  **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 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.
48
49
50
51 In addition, the  **KDE**  and  **GNOME**  desktop environments both have their own window managers which integrate with the desktop. Each window manager also has a different configuration mechanism; 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.
52
53
54
55
56
57 ## Installing X
58
59 **X.org**  or  **XFree86™**  may be installed on DragonFly. DragonFly doesn't force a default implementation, but recommends  **X.org** .  **X.org**  is the X server of the open source X Window System implementation released by the X.Org Foundation and is based on the code of  **XFree86 4.4RC2**  and !X11R6.6.  **X.org**  is currently available in the DragonFly pkgsrc framework.
60
61 To build and install  **X.org**  from the pkgsrc framework:
62     # echo "X11_TYPE=modular" >> /etc/mk.conf
63
64
65 Now 5 different packages need to be built and installed:
66
67     # cd /usr/pkgsrc/x11/modular-xorg-server
68     # bmake install clean
69     # cd /usr/pkgsrc/meta-pkgs/modular-xorg-drivers
70     # bmake install clean
71     # cd /usr/pkgsrc/meta-pkgs/modular-xorg-fonts
72     # bmake install clean
73     # cd /usr/pkgsrc/meta-pkgs/modular-xorg-libs
74     # bmake install clean
75     # cd /usr/pkgsrc/meta-pkgs/modular-xorg-apps
76     # bmake install clean
77
78
79
80 Alternatively, X11 can be installed directly from packages. Binary packages to use with [pkg_radd(1)](http://leaf.dragonflybsd.org/cgi/web-man?command=pkg_radd&section=1) tool are also available for X11.So to fetch and install the package of  **X.org**, type:
81   
82
83     # pkg_radd modular-xorg-server
84     # pkg_radd modular-xorg-drivers
85     # pkg_radd modular-xorg-libs
86     # pkg_radd modular-xorg-apps
87     # pkg_radd modular-xorg-fonts
88
89
90 **Note:** The examples above will install the complete X11 distribution including the server, drivers, fonts etc. Separate packages and ports of X11 are also available.
91
92
93
94
95 ----
96
97
98
99 ## Configuring X
100
101
102
103           ***Contributed by Christopher Shumway. ***
104
105
106
107 ### Before Starting 
108
109
110
111 Before configuration of X11 the following information about the target system is needed:
112
113
114
115
116 * Monitor specifications
117
118
119 * Video Adapter chipset
120
121
122 * Video Adapter memory
123
124
125
126 The specifications for the monitor are used by X11 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.
127
128
129
130 The video adapter's chipset defines what driver module X11 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.
131
132
133
134 Video memory on the graphic adapter determines the resolution and color depth which the system can run at. This is important to know so the user knows the limitations of the system.
135
136
137
138 ### Configuring X11 
139
140
141
142 As of version 7.3, Xorg can often work without any configuration file by simply typing at prompt:
143
144     
145
146     % startx
147
148
149
150
151 If this does not work, or if the default configuration is not acceptable, then X11 must be configured manually. Configuration of X11 is a multi-step process. The first step is to build an initial configuration file. As the super user, simply run:
152
153    
154
155     # Xorg -configure
156
157
158 This will generate an X11 configuration skeleton file in the `/root` directory called `xorg.conf.new` (whether you [su(1)](http://leaf.dragonflybsd.org/cgi/web-man?command=su&section=1) or do a direct login affects the inherited supervisor `$HOME` directory variable). The X11 program will attempt to probe the graphics hardware on the system and write a configuration file to load the proper drivers for the detected hardware on the target system.
159
160
161
162 The next step is to test the existing configuration to verify that  **X.org**  can work with the graphics hardware on the target system. To perform this task, type:
163
164    
165
166     # Xorg -config xorg.conf.new
167
168
169 If a black and grey grid and an X mouse cursor appear, the configuration was successful. To exit the test, just press  **Ctrl** + **Alt** + **Backspace**  simultaneously.
170
171
172
173 **Note:** If the mouse does not work, you will need to first configure it before proceeding. This can usually be achieved by just using `/dev/sysmouse` as the input device in the config file and enabling `moused`:
174
175         # rcenable moused
176
177 **Note** http://technoninja.blogspot.com/2010/07/dragonflybsd-mouse-wtf-problem-fix.html
178
179 Next, tune the `xorg.conf.new` configuration file to taste. Open the file in a text editor such as [vi(1)](http://leaf.dragonflybsd.org/cgi/web-man?command=vi&section=1) or [ee(1)](http://leaf.dragonflybsd.org/cgi/web-man?command=ee&section=1). First, 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 `xorg.conf.new` file under the `"Monitor"` section:
180
181     
182
183     Section "Monitor"
184             Identifier   "Monitor0"
185             VendorName   "Monitor Vendor"
186             ModelName    "Monitor Model"
187             HorizSync    30-107
188             VertRefresh  48-120
189     EndSection
190
191
192
193 The `HorizSync` and `VertRefresh` keywords may be missing in the configuration file. If they are, 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 were entered.
194
195
196
197 X allows DPMS (Energy Star) features to be used with capable monitors. The [xset(1)](http://leaf.dragonflybsd.org/cgi/web-man?command=xset&section=1) program controls the time-outs and can force standby, suspend, or off modes. If you wish to enable DPMS features for your monitor, you must add the following line to the monitor section:
198
199             Option       "DPMS"
200
201
202
203 While the `xorg.conf.new` configuration file is still open in an editor, select the default resolution and color depth desired. This is defined in the `"Screen"` section:
204
205
206
207     
208
209     Section "Screen"
210             Identifier "Screen0"
211             Device     "Card0"
212             Monitor    "Monitor0"
213             DefaultDepth 24
214             SubSection "Display"
215                     Viewport  0 0
216                     Depth     24
217                     Modes     "1024x768"
218             EndSubSection
219     EndSection
220
221
222 The `DefaultDepth` keyword describes the color depth to run at by default. This can be overridden with the `-depth` command line switch to [Xorg(1)](http://leaf.dragonflybsd.org/cgi/web-man?command=xorg&section=1). The `Modes` keyword describes the resolution to run at for the given color depth. Note that only VESA standard modes are supported as defined by the target system's graphics hardware. In the example above, the default color depth is twenty-four bits per pixel. At this color depth, the accepted resolution is 1024 by 768 pixels.
223
224
225 Finally, write the configuration file and test it using the test mode given above.
226
227
228 **Note:** One of the tools available to assist you during troubleshooting process are the X11 log files, which contain information on each device that the X11 server attaches to.  **X.org**  log file names are in the format of `/var/log/Xorg.0.log`. The exact name of the log can vary from `Xorg.0.log` to `Xorg.8.log` and so forth.
229
230
231
232 If all is well, the configuration file needs to be installed in a common location where [Xorg(1)](http://leaf.dragonflybsd.org/cgi/web-man?command=xorg&section=1) can find it. This is typically `/etc/X11/xorg.conf` or `/usr/pkg/xorg/lib/X11/xorg.conf`.
233
234
235
236     # cp xorg.conf.new /etc/X11/xorg.conf
237
238
239
240 The X11 configuration process is now complete. You can start  **X.org**  with [startx(1)](http://leaf.dragonflybsd.org/cgi/web-man?command=startx&section=1). The X11 server may also be started with the use of [xdm(1)](http://leaf.dragonflybsd.org/cgi/web-man?command=xdm&section=1).
241
242
243 **Note:** There is also a graphical configuration tool, [xorgcfg(1)](http://leaf.dragonflybsd.org/cgi/web-man?command=xorgcfg&section=1), that comes with the X11 distribution. It allows you to interactively define your configuration by choosing the appropriate drivers and settings. This program can be invoked from the console, by typing the command `xorgcfg -textmode`. For more details, refer to the [xorgcfg(1)](http://leaf.dragonflybsd.org/cgi/web-man?command=xorgcfg&section=1) manual page.
244
245
246 Alternatively, there is also a tool called [xorgconfig(1)](http://leaf.dragonflybsd.org/cgi/web-man?command=xorgconfig&section=1), this program is a console utility that is less user friendly, but it may work in situations where the other tools do not.
247
248
249
250 ### Advanced Configuration Topics 
251
252
253
254 #### Configuration with Intel® i810 Graphics Chipsets 
255
256
257
258 Configuration with Intel® i810 integrated chipsets requires the `agpgart` AGP programming interface for X11 to drive the card. See the [agp(4)](http://leaf.dragonflybsd.org/cgi/web-man?command=agp&section=4) driver manual page for more information.
259
260
261 This will allow configuration of the hardware as any other graphics board. Note on systems without the [agp(4)](http://leaf.dragonflybsd.org/cgi/web-man?command#agp&section4) driver compiled in the kernel, trying to load the module with [kldload(8)](http://leaf.dragonflybsd.org/cgi/web-man?command=kldload&section=8) will not work. This driver has to be in the kernel at boot time through being compiled in or using `/boot/loader.conf`.
262
263
264 **Note:** If you are using  **XFree86 4.1.0**  (or later) and messages about unresolved symbols like `fbPictureInit` appear, try adding the following line after `Driver "i810"` in the X11 configuration file:
265
266               Option "NoDDC"
267
268
269
270
271
272 ----
273
274
275
276
277
278
279 ## Using Fonts in X11 
280 <!-- XXX: do we really need this? -->
281
282
283  ***Contributed by Murray Stokely. ***
284
285
286
287 ### Type1 Fonts 
288
289
290
291  The default fonts that ship with X11 are less than ideal for typical desktop publishing applications. Large presentation fonts show up jagged and unprofessional looking, and small fonts in  **Netscape®**  are almost completely unintelligible. However, there are several free, high quality Type1 (Post***Script®) fonts available which can be readily used with X11. For instance, the Freefonts collection (['fonts/freefonts'](http://pkgsrc.se/fonts/freefonts)) includes a lot of 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, X11 can be configured to use True***Type® fonts with a minimum of effort. For more details on this, see the [X(7)](http://leaf.dragonflybsd.org/cgi/web-man?command=X&section=7) manual page or the [ section on TrueType fonts](x-fonts.html#TRUETYPE).
292
293
294
295  To install the Freefonts font collection from the pkgsrc framework, run the following commands:
296
297
298
299      
300
301     # cd /usr/pkgsrc/fonts/freefonts
302
303     # bmake install clean
304
305
306
307
308
309  And likewise with the other collections. To have the X server detect these fonts, add an appropriate line to the X server configuration file in `/etc/X11/xorg.conf`, which reads:
310
311
312
313      
314
315     FontPath "/usr/pkg/lib/X11/fonts/freefont/"
316
317
318
319
320
321  Alternatively, at the command line in the X session run:
322
323
324
325      
326
327     % xset fp+ /usr/pkg/lib/X11/fonts/freefont/
328
329     % xset fp rehash
330
331
332
333
334
335  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 `/usr/pkg/xorg/etc/fonts/local.conf` file: see the section on [ anti-aliasing](x-fonts.html#ANTIALIAS).
336
337
338
339 ### TrueType® Fonts 
340
341
342
343   **X.org**  has built in support for rendering True***Type 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 the `/etc/X11/xorg.conf` file.
344
345
346
347      
348
349     Load  "freetype"
350
351
352
353
354
355  Now make a directory for the True***Type fonts (for example, `/usr/pkg/xorg/lib/X11/fonts/TrueType`) and copy all of the True***Type fonts into this directory. Keep in mind that True***Type fonts cannot be directly taken from a Macintosh®; they must be in UNIX®/MS-DOS®/Windows® format for use by X11. 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 these new files have been installed. 'ttmkfdir' is available from the pkgsrc framework as [`fonts/ttmkfdir2`](http://pkgsrc.se/fonts/ttmkfdir2).
356
357
358
359      
360
361     # cd /usr/pkg/xorg/lib/X11/fonts/TrueType
362
363     # ttmkfdir -o fonts.dir
364
365
366
367
368
369  Now add the True***Type directory to the font path. This is just the same as described above for [ Type1](x-fonts.html#TYPE1) fonts, that is, use
370
371
372
373     
374
375     % xset fp+ /usr/pkg/xorg/lib/X11/fonts/TrueType
376
377     % xset fp rehash
378
379
380
381
382
383  or add a `FontPath` line to the `xorg.conf` file.
384
385
386
387  That's it. Now  **Netscape** ,  **Gimp** , ***'Star***Office™***', and all of the other X applications should now recognize the installed True***Type fonts. Extremely small fonts (as with text in a high resolution display on a web page) and extremely large fonts (within  **Star`Office** ) will look much better now.
388
389
390
391 ### Anti-Aliased Fonts 
392
393
394
395  ***Updated by Joe Marcus Clarke. ***
396
397
398
399  Anti-aliasing has been available in X11 since  **XFree86**  4.0.2. However, font configuration was cumbersome before the introduction of  **XFree86**  4.3.0. Beginning with  **XFree86**  4.3.0, all fonts in X11 that are found in `/usr/pkg/xorg/lib/X11/fonts/` and `~/.fonts/` are automatically made available for anti-aliasing to Xft-aware applications. Not all applications are Xft-aware, but many have received Xft support. Examples of Xft-aware applications include Qt 2.3 and higher (the toolkit for the  **KDE**  desktop), GTK+ 2.0 and higher (the toolkit for the  **GNOME**  desktop), and  **Mozilla**  1.2 and higher.
400
401
402
403  In order to control which fonts are anti-aliased, or to configure anti-aliasing properties, create (or edit, if it already exists) the file `/usr/pkg/xorg/lib/etc/fonts/local.conf`. Several advanced features of the Xft font system can be tuned using this file; this section describes only some simple possibilities. For more details, please see [fonts-conf(5)](http://leaf.dragonflybsd.org/cgi/web-man?command=fonts-conf&section=5).
404
405
406
407  This file must be in XML format. Pay careful attention to case, and make sure all tags are properly closed. The file begins with the usual XML header  followed by a DOCTYPE definition, and then the `<fontconfig>` tag:
408
409
410
411      
412
413           <?xml version="1.0"?>;
414
415           <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
416
417           <fontconfig>
418
419
420
421
422
423  As previously stated, all fonts in `/usr/pkg/xorg/lib/X11/fonts/` as well as `~/.fonts/` are already made available to Xft-aware applications. If you wish to add another directory outside of these two directory trees, add a line similar to the following to `/usr/pkg/lib/etc/fonts/local.conf`:
424
425
426
427      
428
429     <dir>/path/to/my/fonts</dir>;
430
431
432
433
434
435  After adding new fonts, and especially new font directories, you should run the following command to rebuild the font caches:
436
437
438
439      
440
441     # fc-cache -f
442
443
444
445
446
447  Anti-aliasing 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 font sizes smaller than 14 point from anti-aliasing, include these lines:
448
449
450
451      
452
453             <match target="font">
454
455                 <test name#"size" compare"less">
456
457                     <double>14</double>
458
459                 </test>
460
461                 <edit name#"antialias" mode"assign">
462
463                     <bool>false</bool>
464
465                 </edit>
466
467             </match>
468
469             <match target="font">
470
471                 <test name#"pixelsize" compare"less" qual="any">
472
473                     <double>14</double>
474
475                 </test>
476
477                 <edit mode#"assign" name"antialias">
478
479                     <bool>false</bool>
480
481                 </edit>
482
483             </match>
484
485
486
487
488
489  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:
490
491
492
493      
494
495            <match target#"pattern" name"family">
496
497                <test qual#"any" name"family">
498
499                    <string>fixed</string>
500
501                </test>
502
503                <edit name#"family" mode"assign">
504
505                    <string>mono</string>
506
507                </edit>
508
509             </match>
510
511             <match target#"pattern" name"family">
512
513                 <test qual#"any" name"family">
514
515                     <string>console</string>
516
517                 </test>
518
519                 <edit name#"family" mode"assign">
520
521                     <string>mono</string>
522
523                 </edit>
524
525             </match>
526
527
528
529
530
531  (this aliases the other common names for fixed fonts as `"mono"`), and then add:
532
533
534
535      
536
537              <match target#"pattern" name"family">
538
539                  <test qual#"any" name"family">
540
541                      <string>mono</string>
542
543                  </test>
544
545                  <edit name#"spacing" mode"assign">
546
547                      <int>100</int>
548
549                  </edit>
550
551              </match>
552
553
554
555
556
557  Certain fonts, such as Helvetica, may have a problem when anti-aliased. Usually this manifests itself as a font that seems cut in half vertically. At worst, it may cause applications such as  **Mozilla**  to crash. To avoid this, consider adding the following to `local.conf`:
558
559
560
561      
562
563              <match target#"pattern" name"family">
564
565                  <test qual#"any" name"family">
566
567                      <string>Helvetica</string>
568
569                  </test>
570
571                  <edit name#"family" mode"assign">
572
573                      <string>sans-serif</string>
574
575                  </edit>
576
577              </match>
578
579
580
581
582
583  Once you have finished editing `local.conf` make sure you end the file with the `</fontconfig>` tag. Not doing this will cause your changes to be ignored.
584
585
586
587  The default font set that comes with X11 is not very desirable when it comes to anti-aliasing. A much better set of default fonts can be found in the ['fonts/vera-ttf'](http://pkgsrc.se/fonts/vera-ttf) port. This port will install a `/usr/pkg/lib/etc/fonts/local.conf` file if one does not exist already. If the file does exist, the port will create a `/usr/pkg/lib/etc/fonts/local.conf-vera ` file. Merge the contents of this file into `/usr/pkg/lib/etc/fonts/local.conf`, and the Bitstream fonts will automatically replace the default X11 Serif, Sans Serif, and Monospaced fonts.
588
589
590
591  Finally, users can add their own settings via their personal `.fonts.conf` files. To do this, each user should simply create a `~/.fonts.conf`. This file must also be in XML format.
592
593
594
595  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 `local.conf` file:
596
597
598
599      
600
601              <match target="font">
602
603                  <test qual#"all" name"rgba">
604
605                      <const>unknown</const>
606
607                  </test>
608
609                  <edit name#"rgba" mode"assign">
610
611                      <const>rgb</const>
612
613                  </edit>
614
615              </match>
616
617
618
619
620
621    **Note:** Depending on the sort of display, `rgb` may need to be changed to `bgr`, `vrgb` or `vbgr`: experiment and see which works best.
622
623
624
625
626
627  Anti-aliasing should be enabled the next time the X server is started. However, programs must know how to take advantage of it. At present, the Qt toolkit does, so the entire  **KDE**  environment can use anti-aliased fonts. GTK+ and  **GNOME**  can also be made to use anti-aliasing via the "Font" capplet (see [x11-wm.html#X11-WM-GNOME-ANTIALIAS Section 5.7.1.3] for details). By default,  **Mozilla**  1.2 and greater will automatically use anti-aliasing. To disable this, rebuild  **Mozilla**  with the `-DWITHOUT_XFT` flag.
628
629
630 ----
631
632
633
634 ## The X Display Manager 
635
636  ***Contributed by Seth Kingsley.***
637
638
639
640 ### Overview 
641
642
643
644  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 situations, including minimal "X Terminals", desktops, and large network display 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 a graphical interface for choosing which display server to connect to, and entering authorization information such as a login and password combination.
645
646
647
648  Think of  **XDM**  as providing the same functionality to the user as the [getty(8)](http://leaf.dragonflybsd.org/cgi/web-man?command=getty&section=8) utility (see [ Section 17.3.2](term.html#TERM-CONFIG) for 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 program to exit, signaling that the user is done and should be logged out of the display. At this point,  **XDM**  can display the login and display chooser screens for the next user to login.
649
650
651
652 ### Using XDM 
653
654
655
656  The  **XDM**  daemon program is located in `/usr/pkg/xorg/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 [ Section 17.3.2.1](term.html#TERM-ETCTTYS). There is a line in the default `/etc/ttys` file for running the  **XDM**  daemon on a virtual terminal:
657
658
659
660      
661
662     ttyv8   "/usr/pkg/xorg/bin/xdm -nodaemon"  xterm   off secure
663
664
665
666
667
668  By default this entry is disabled; in order to enable it change field 5 from `off` to `on` and restart [init(8)](http://leaf.dragonflybsd.org/cgi/web-man?command=init&section=8) using the directions in [ Section 17.3.2.2](term.html#TERM-HUP). 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.
669
670
671
672 ### Configuring XDM 
673
674
675
676  The  **XDM**  configuration directory is located in `/var/lib/xdm`. The sample configuration files are in `/usr/pkg/share/examples/xorg/xdm/`, in this directory there are several files used to change the behavior and appearance of  **XDM** . Typically these files will be found:
677
678
679 [[!table  data="""
680 <tablestyle="width:100%">  **File**  |  **Description**
681 <tablestyle="width:100%"> `Xaccess` | Client authorization ruleset.
682 `Xresources` | Default X resource values.
683 `Xservers` | List of remote and local displays to manage.
684 `Xsession` | Default session script for logins.
685 `Xsetup_`* | Script to launch applications before the login interface.
686 `xdm-config` | Global configuration for all displays running on this machine.
687 `xdm-errors` | Errors generated by the server program.
688 `xdm-pid` | The process ID of the currently running XDM. |
689
690 """]]
691
692
693  Also in this directory are a few scripts and programs used to set up the desktop when  **XDM**  is 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 [xdm(1)](http://leaf.dragonflybsd.org/cgi/web-man?command=xdm&section=1).
694
695
696
697  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 for changing the look and feel of  **XDM**  screens.
698
699
700
701 #### Xaccess 
702
703
704
705  The protocol for connecting to  **XDM**  controlled displays is called the X Display Manager Connection Protocol (XDMCP). This file is a ruleset for controlling XDMCP connections from remote machines. It is ignored unless the `xdm-config` is changed to listen for remote connections. By default, it does not allow any clients to connect.
706
707
708
709 #### Xresources 
710
711
712
713  This is an application-defaults file for the display 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 X11 documentation.
714
715
716
717 #### Xservers 
718
719
720
721  This is a list of the remote displays the chooser should provide as choices.
722
723
724
725 #### Xsession 
726
727
728
729  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 `~/.xsession` that overrides this script.
730
731
732
733 #### Xsetup_* 
734
735
736
737  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`.
738
739
740
741 #### xdm-config 
742
743
744
745  This contains settings in the form of app-defaults that are applicable to every display that this installation manages.
746
747
748
749 #### xdm-errors 
750
751
752
753  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 `~/.xsession-errors` file on a per-session basis.
754
755
756
757 ### Running a Network Display Server 
758
759
760
761  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:
762
763
764
765      
766
767     ! SECURITY: do not listen for XDMCP or Chooser requests
768
769     ! Comment out this line if you want to manage X terminals with xdm
770
771     DisplayManager.requestPort:     0
772
773
774
775
776
777  and then restart  **XDM** . Remember that comments in app-defaults files begin with a "!" character, not the usual "#". More strict access controls may be desired. Look at the example entries in `Xaccess`, and refer to the [xdm(1)](http://leaf.dragonflybsd.org/cgi/web-man?command=xdm&section=1) manual page for further information.
778
779
780
781 ### Replacements for XDM 
782
783
784
785  Several replacements for the default  **XDM**  program exist. One of them,  **kdm**  (bundled with  **KDE** ) is described later in this chapter. The  **kdm**  display manager 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.
786
787
788 ----
789
790
791
792 ## Desktop Environments 
793
794  ***Contributed by Valentino Vaschetto. ***
795
796  This section describes the different desktop environments available for X on FreeBSD. A ***desktop environment*** can mean anything ranging from a simple window manager to a complete suite of desktop applications, such as  **KDE**  or  **GNOME** .
797
798
799
800 ### GNOME 
801
802
803
804 #### About GNOME 
805
806
807
808    **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 operating systems or environments should feel right at home using the powerful graphics-driven environment that  **GNOME**  provides.
809
810
811
812 #### Installing GNOME 
813
814
815
816    **GNOME**  can be easily installed from a package or from the pkgsrc framework:
817
818
819
820   To install the  **GNOME**  package from the network, simply type:
821
822     # pkg_radd gnome
823
824
825
826
827
828   To build  **GNOME**  from source, use the ports tree:
829
830       
831
832     # cd /usr/pkgsrc/meta-pkgs/gnome
833
834     # bmake install clean
835
836
837
838   Once  **GNOME**  is installed, the X server must be told to start  **GNOME**  instead of a default window manager.
839
840
841
842   The easiest way to start  **GNOME**  is with  **GDM** , the GNOME Display Manager.  **GDM** , which is installed as a part of the  **GNOME**  desktop (but is disabled by default), can be enabled by adding `gdm_enable="YES"` to `/etc/rc.conf`. Once you have rebooted,  **GNOME**  will start automatically once you log in -- no further configuration is necessary.
843
844
845
846 **GNOME**  may also be started from the command-line by properly configuring a file named `.xinitrc`. If a custom `.xinitrc` is already in place, simply replace the line that starts the current window manager with one that starts  **/usr/pkg/bin/gnome-session**  instead. If nothing special has been done to the configuration file, then it is enough simply to type:
847
848
849
850       
851
852     % echo "/usr/pkg/bin/gnome-session" > ~/.xinitrc
853
854
855
856
857
858   Next, type `startx`, and the  **GNOME**  desktop environment will be started.
859
860
861 **Note:** If an older 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/pkg/bin/gnome-session** :
862
863
864
865         
866
867     % echo "#!/bin/sh" > ~/.xsession
868
869     % echo "/usr/pkg/bin/gnome-session" >> ~/.xsession
870
871     % chmod +x ~/.xsession
872
873
874
875
876
877   Yet another option is to configure the display manager to allow choosing the window manager at login time; the section on [ KDE details](x11-wm.html#X11-WM-KDE-DETAILS) explains how to do this for  **kdm** , the display manager of  **KDE** .
878
879
880
881 #### Anti-aliased Fonts with GNOME 
882
883
884
885   X11 supports anti-aliasing via its ***RENDER*** extension. GTK+ 2.0 and greater (the toolkit used by  **GNOME** ) can make use of this functionality. Configuring anti-aliasing is described in [ Section 5.5.3](x-fonts.html#ANTIALIAS).
886   
887   So, with up-to-date software, anti-aliasing is possible within the  **GNOME**  desktop. Just go to  **Applications->Desktop Preferences->Font** , and select either Best shapes, Best contrast, or Subpixel smoothing (LCDs). For a GTK+ application that is not part of the  **GNOME**  desktop, set the environment variable `GDK_USE_XFT` to `1` before launching the program.
888
889
890
891 ### KDE 
892
893
894
895 #### About KDE 
896
897
898
899   **KDE**  is an easy to use contemporary desktop environment. Some of the things that  **KDE**  brings to the user are:
900
901 * A beautiful contemporary desktop
902
903 * A desktop exhibiting complete network transparency
904
905 * An integrated help system allowing for convenient, consistent access to help on the use of the  **KDE**  desktop and its applications
906
907 * Consistent look and feel of all  **KDE**  applications
908
909 * Standardized menu and toolbars, keybindings, color-schemes, etc.
910
911 * Internationalization:  **KDE**  is available in more than 40 languages
912
913 * Centralized consisted dialog driven desktop configuration
914
915 * A great number of useful  **KDE**  applications
916
917   **KDE**  comes with a web browser called  **Konqueror** , which represents a solid competitor to other existing web browsers on UNIX® systems. More information on  **KDE**  can be found on the [KDE website](http://www.kde.org/).
918
919
920
921 #### Installing KDE 
922
923
924  Just as with  **GNOME**  or any other desktop environment, the easiest way to install  **KDE**  is through the pkgsrc framework or from a package:
925
926
927
928  To install the  **KDE**  package from the network, simply type:
929
930    # pkg_radd kde3
931
932  or if you prefer the newer **KDE 4**, type:
933  
934    # pkg_radd kde4
935
936  [pkg_radd(1)](http://leaf.dragonflybsd.org/cgi/web-man?command#pkg_radd&section1) will automatically fetch the latest version of the application.
937
938
939  To build  **KDE**  from source, use the pkgsrc framework:
940
941     # cd /usr/pkgsrc/meta-pkgs/kde3
942
943     # bmake install clean
944
945
946
947
948
949  After  **KDE**  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:
950
951
952     % echo "exec startkde" > ~/.xinitrc
953
954
955  Now, whenever the X Window System is invoked with `startx`,  **KDE**  will be the desktop.
956
957  If a display manager such as  **XDM**  is being used, the configuration is slightly different. Edit the `.xsession` file instead. Instructions for  **kdm**  are described later in this chapter.
958
959
960
961 #### More Details on KDE 
962
963
964
965  Now that  **KDE**  is installed on 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.
966
967  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.
968
969
970
971 #### The KDE Display Manager 
972
973
974
975  An administrator of a multi-user system may wish to have a graphical login screen to welcome users. [ XDM](x-xdm.html) 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 ( **KDE** ,  **GNOME** , or something else) to run after logging on.
976
977
978
979  To enable  **kdm** , the `ttyv8` entry in `/etc/ttys` has to be adapted. The line should look as follows:
980   
981
982     ttyv8 "/usr/pkg/bin/kdm -nodaemon" xterm on secure
983
984
985     
986 ### XFce 
987
988
989
990 #### About XFce 
991
992
993   **XFce**  is a desktop environment 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:
994
995 * A simple, easy-to-handle desktop
996
997 * Fully configurable via mouse, with drag and drop, etc
998
999 * Main panel similar to  **CDE** , with menus, applets and applications launchers
1000
1001 * Integrated window manager, file manager, sound manager,  **GNOME**  compliance module, and other things
1002
1003 * Themeable (since it uses GTK+)
1004
1005 * Fast, light and efficient: ideal for older/slower machines or machines with memory limitations
1006
1007
1008 More information on  **XFce**  can be found on the [XFce website](http://www.xfce.org/).
1009
1010
1011
1012 #### Installing XFce 
1013
1014
1015
1016  A binary package for  **XFce**  exists. To install, simply type:
1017
1018     # pkg_radd xfce4
1019
1020
1021  Alternatively, to build from source, use the pkgsrc framework:
1022
1023    
1024
1025     # cd /usr/pkgsrc/meta-pkgs/xfce4
1026
1027     # bmake install clean
1028
1029
1030
1031
1032  Now, tell the X server to launch  **XFce**  the next time X is started. Simply type this:
1033
1034     % echo "/usr/pkg/bin/startxfce4" > ~/.xinitrc
1035
1036
1037
1038  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](x11-wm.html#X11-WM-GNOME), but with the `/usr/pkg/bin/startxfce4` command; or, configure the display manager to allow choosing a desktop at login time, as explained in the section on [ kdm](x11-wm.html#X11-WM-KDE-KDM).
1039
1040
1041
1042 <!-- XXX: FreeBSD's handbook has a nice user-oriented section about X applications here. maybe we should have one, too -->
1043
1044 ----