50d8bd25458c384da04ad342b29b76c2c4bbe0bb
[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. Updated for 2014 pkgng by Warren Postma***
3
4 [[!toc  levels=3]]
5
6
7 ## Synopsis 
8
9
10 This chapter will cover the installation and some configuration of the usual way of giving your Dragonfly BSD system an X-Windows style Graphical User Interface (GUI) and a modern Desktop Environment.  In Unix systems, the graphical drawing system is provided by the combination of an X11R6 compliant X-Windows Server, such as the X.org server, and other software such as Window Managers and Desktop Environments.  This multi-layered approach may be surprising to people coming from systems like the Mac or like Windows where these components are not so flexible, or provided by so many separately installed and configured pieces. 
11
12 For more information on the video hardware support in X.org, check the [X.org](http://www.x.org/) web site. If you have problems configuring your X server, just search the web. There are lots of tutorials and guides on how to set up your X properly, if the information in this page is not enough for your situation.
13
14 Before reading this chapter, you should know how to install additional third-party software. Read the  `dports` section of the documentation, for DragonFly 3.4 and later.
15
16
17
18
19
20 ## Understanding X 
21
22 ### What is X.Org
23
24 X.Org is the most popular free implementation of the X11 specification.  The X11 specification is an open standard, and there are other implementations, some commercial, and some free.
25
26 ### The Window Manager and the Desktop Environment
27
28 An X Server is a very low level piece of software.  It does not provide any way to move windows around or resize them. It does not provide a title bar on the top of your windows, or a dock, or any menus.
29
30 These things are the job, in the oldest style of X environment, of your window manager, or in more recent times, of a Desktop Environment.
31
32 Installing X.org by itself does not give you any window manager or any desktop environment. You will have to choose one and install it yourself. Until you select one, your system will not be usable.
33
34 There are dozens of window managers and desktop environments available for X. The most retro ones you might chose include `fvwm` and `twm` which have that retro 1980s workstation look and feel.  There are also window managers included inside modern desktop environments like XFCE, KDE and Gnome.  
35
36 If you are brand new and don't know what to do, select the XFCE4 desktop and follow those instructions.
37 Every desktop environment and window manager also has a different configuration mechanism. Read your chosen environment's documentation to learn more.   Some are configured by text files alone, and some (like KDE and Gnome) have sophisticated graphical configuration utilities and "control panels".
38
39 Note that XFCE4 and Gnome and KDE do not require you to install any window manager as they include one automatically.
40
41
42 ## Installing X
43
44 **X.org**  is currently available in the DragonFly dports collection.
45
46 To install:
47
48     # pkg install xorg-7.7
49
50 By the time you read this, it might be a newer version of xorg than 7.7, you can also try this general command:
51
52     # pkg install xorg
53
54
55
56 ## Configuring X
57
58
59
60           ***Contributed by Christopher Shumway. ***
61
62
63 As of version 7.3, Xorg can often work without any configuration file by simply typing at prompt:
64
65     
66
67     % startx
68
69 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:
70    
71
72     # Xorg -configure
73
74
75 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.
76
77
78
79 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:
80
81    
82
83     # Xorg -config xorg.conf.new
84
85
86 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.
87
88
89
90 **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`:
91
92         # rcenable moused
93
94
95
96 Tune the `xorg.conf.new` configuration file to taste and move it to 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`.
97
98     
99
100 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).
101
102
103
104
105 ## The X Display Manager 
106
107  ***Contributed by Seth Kingsley.***
108
109
110
111 ### Overview 
112
113
114
115  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.
116
117
118
119  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.
120
121
122
123 ### Using XDM 
124
125
126
127  The  **XDM**  daemon program is located in `/usr/pkg/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:
128
129
130
131      
132
133     ttyv8   "/usr/pkg/bin/xdm -nodaemon"  xterm   off secure
134
135
136
137
138
139  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.
140
141
142
143 ### Configuring XDM 
144
145
146
147  The  **XDM**  configuration directory is located in `/var/lib/xdm`. The sample configuration files are in `/usr/pkg/share/examples/xdm/`, in this directory there are several files used to change the behavior and appearance of  **XDM** . Typically these files will be found:
148
149
150 [[!table  data="""
151 <tablestyle="width:100%">  **File**  |  **Description**
152 <tablestyle="width:100%"> `Xaccess` | Client authorization ruleset.
153 `Xresources` | Default X resource values.
154 `Xservers` | List of remote and local displays to manage.
155 `Xsession` | Default session script for logins.
156 `Xsetup_`* | Script to launch applications before the login interface.
157 `xdm-config` | Global configuration for all displays running on this machine.
158 `xdm-errors` | Errors generated by the server program.
159 `xdm-pid` | The process ID of the currently running XDM. |
160
161 """]]
162
163
164  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).
165
166
167
168  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.
169
170
171
172 #### Xaccess 
173
174
175
176  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.
177
178
179
180 #### Xresources 
181
182
183
184  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.
185
186
187
188 #### Xservers 
189
190
191
192  This is a list of the remote displays the chooser should provide as choices.
193
194
195
196 #### Xsession 
197
198
199
200  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.
201
202
203
204 #### Xsetup_* 
205
206
207
208  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`.
209
210
211
212 #### xdm-config 
213
214
215
216  This contains settings in the form of app-defaults that are applicable to every display that this installation manages.
217
218
219
220 #### xdm-errors 
221
222
223
224  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.
225
226
227
228 ### Running a Network Display Server 
229
230
231
232  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:
233
234
235
236      
237
238     ! SECURITY: do not listen for XDMCP or Chooser requests
239
240     ! Comment out this line if you want to manage X terminals with xdm
241
242     DisplayManager.requestPort:     0
243
244
245
246
247
248  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.
249
250
251
252 ### Replacements for XDM 
253
254
255
256  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.
257
258
259 ----
260
261
262
263 ## Desktop Environments 
264
265  ***Contributed by Valentino Vaschetto. ***
266
267  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** .
268
269
270
271 ### GNOME 
272
273
274
275 #### About GNOME 
276
277
278
279    **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.
280
281
282
283 #### Installing GNOME 
284
285
286
287    **GNOME**  can be easily installed from a package or from the pkgsrc framework:
288
289
290
291   To install the  **GNOME**  package from the network, simply type:
292
293     # pkg install gnome-desktop
294
295
296
297
298   To build  **GNOME**  from source, if you have the pkgsrc tree on your system:      
299
300     # cd /usr/pkgsrc/meta-pkgs/gnome
301
302     # bmake install clean
303
304
305
306   Once  **GNOME**  is installed, the X server must be told to start  **GNOME**  instead of a default window manager.
307
308
309
310   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.
311
312
313
314 **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:
315
316
317
318       
319
320     % echo "/usr/pkg/bin/gnome-session" > ~/.xinitrc
321
322
323
324
325
326   Next, type `startx`, and the  **GNOME**  desktop environment will be started.
327
328
329 **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** :
330
331
332
333         
334
335     % echo "#!/bin/sh" > ~/.xsession
336
337     % echo "/usr/pkg/bin/gnome-session" >> ~/.xsession
338
339     % chmod +x ~/.xsession
340
341
342
343
344
345   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** .
346
347
348
349 #### Anti-aliased Fonts with GNOME 
350
351
352
353   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).
354   
355   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.
356
357
358
359 ### KDE 
360
361
362
363 #### About KDE 
364
365
366
367   **KDE**  is an easy to use contemporary desktop environment. Some of the things that  **KDE**  brings to the user are:
368
369 * A beautiful contemporary desktop
370
371 * A desktop exhibiting complete network transparency
372
373 * An integrated help system allowing for convenient, consistent access to help on the use of the  **KDE**  desktop and its applications
374
375 * Consistent look and feel of all  **KDE**  applications
376
377 * Standardized menu and toolbars, keybindings, color-schemes, etc.
378
379 * Internationalization:  **KDE**  is available in more than 40 languages
380
381 * Centralized consisted dialog driven desktop configuration
382
383 * A great number of useful  **KDE**  applications
384
385   **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/).
386
387
388
389 #### Installing KDE 
390
391
392  Just as with  **GNOME**  or any other desktop environment, the easiest way to install  **KDE**  is through the pkgsrc framework or from a package:
393
394
395
396  To install the  **KDE**  4.10 package from the network, simply type:
397
398    # pkg install kde-4.10
399
400
401  To build  **KDE**  from source, using the pkgsrc framework:
402
403     # cd /usr/pkgsrc/meta-pkgs/kde3
404
405     # bmake install clean
406
407
408
409
410
411  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:
412
413
414     % echo "exec startkde" > ~/.xinitrc
415
416
417  Now, whenever the X Window System is invoked with `startx`,  **KDE**  will be the desktop.
418
419  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.
420
421
422
423 #### More Details on KDE 
424
425
426
427  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.
428
429  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.
430
431
432
433 #### The KDE Display Manager 
434
435
436
437  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.
438
439
440
441  To enable  **kdm** , the `ttyv8` entry in `/etc/ttys` has to be adapted. The line should look as follows:
442   
443
444     ttyv8 "/usr/pkg/bin/kdm -nodaemon" xterm on secure
445
446
447     
448 ### XFce 
449
450
451
452 #### About XFce 
453
454
455   **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:
456
457 * A simple, easy-to-handle desktop
458
459 * Fully configurable via mouse, with drag and drop, etc
460
461 * Main panel similar to  **CDE** , with menus, applets and applications launchers
462
463 * Integrated window manager, file manager, sound manager,  **GNOME**  compliance module, and other things
464
465 * Themeable (since it uses GTK+)
466
467 * Fast, light and efficient: ideal for older/slower machines or machines with memory limitations
468
469
470 More information on  **XFce**  can be found on the [XFce website](http://www.xfce.org/).
471
472
473
474 #### Installing XFce 
475
476
477
478  A binary package for  **XFce**  exists. To install, simply type:
479
480     # pkg install xfce4
481
482
483  Alternatively, to build from source, use the pkgsrc framework:
484
485    
486
487     # cd /usr/pkgsrc/meta-pkgs/xfce4
488
489     # bmake install clean
490
491
492
493
494  Now, tell the X server to launch  **XFce**  the next time X is started. Simply type this:
495
496     % echo "/usr/pkg/bin/startxfce4" > ~/.xinitrc
497
498
499
500  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).
501
502
503
504 <!-- XXX: FreeBSD's handbook has a nice user-oriented section about X applications here. maybe we should have one, too -->
505
506 ----