v3.1 10 October 2002
Revision History | ||
---|---|---|
Revision v3.1 | 2002-10-10 | Revised by: hb |
Some minor additions and updates. | ||
Revision v3.0 | 2002-03-06 | Revised by: hb |
Rewrite of the original document. Convert to DocBook. Many, many changes. |
The X Window System is an advanced, graphical computing and network environment that was designed from the ground up as a multi-user system. X was first released in 1984. If you are not familiar with the basic concepts surrounding X and it's related components, you should first read the X Window System Architecture Overview HOWTO, http://linuxdoc.org/HOWTO/XWindow-Overview-HOWTO/index.html, to get an idea of how the various pieces fit together. There is also an attempt to define to various X related terminology in the Appendix, if concepts such as "displays" and "X clients" in this context are confusing to you.
This document will address basic X Window configuration and usage on Linux. We will also look at how X is commonly started in Linux, and how the start up can be configured, and related issues. We will not examine Window Manager (e.g. fvwm), or Desktop Environment (KDE and GNOME) configuration. There are just too many variables there, and the pace of change moves too quickly. Of course, to a large extent the user interacts more directly with these components than the X server itself, so additional reading would be worthwhile. Check your locally installed documentation, and the respective home pages for more information.
Some other important points to remember here:
X is a client-server, multi-user system in every respect, and not just a GUI.
X is not integrated into the operating system, and rides on top of it, like other servers.
X is an open standard, and runs on many platforms.
What you actually see on the screen is the result of various components, all working together: operating system, X, Window Manager, and optionally, a desktop environment like GNOME or KDE. These are all "plug and play" components, meaning you can interchange an individual component without touching the other components.
Each of the various components has its own configuration. This makes for a very flexible, and potentially very robust, system. It also adds complexity.
The discussion here will be limited to X as implemented by The XFree86 Project, Inc. on Linux. There are other implementations, including commercial ones. XFree86 v4.x has been out for some time now, so we will be assuming that version. Much of the discussion applies to the previous 3.x version as well, but there are some occasional differences.
It is also worth noting that there are conceivably many ways to start X, and to set up a Linux system. We will focus on the common methods found in Linux distributions. Also, vendors may vary on where they put configuration files, and how they name them. Keep this in mind if you see such discrepancies in this document. If this is a problem, your vendor surely has their own documentation. And as always, hopefully the man pages will conform to your installation.
Also, we will look at various configuration files in the following sections. These are all plain text files, and can be edited with your favorite editor. Always make a backup copy before editing important files, in case Murphy pays a visit (e.g. "cp /etc/X11/XF86Config-4 /etc/X11/XF86Config-4.bak").
The current official version of this HOWTO may be found at the Linux Documentation Project, http://www.linuxdoc.org/HOWTO/XWindow-User-HOWTO.html. Pre-release versions may be periodically posted to http://feenix.burgiss.net/ldp/x-user/.
v3.1: This is just some small, minor updates. Include link to http://www.plig.org/xwinman/ as a good resource for shopping Window Managers. Add link for fluxbox, a Window Manager with Tabbed windows. And add a brief section on improving network performance. Verify links all work.
v3.0: This is a major rewrite with several new sections. Some sections were removed, with the focus more now on just X itself (and not clients like Window Managers). New maintainer too :-)
v2.0: includes corrections from Guus Bosch, Brian J. Miller, and myself, as well as lots of new updates and info.
v1.4: include corrections and additions from Anthony J., and some very good security tips from Tomasz Motylewski.
If you have questions or comments about this document, please feel free to email me, Hal Burgiss at <hal@foobox.net>. I welcome any suggestions, corrections, or additions. If you have information you would like to see in future revisions, or you would like to contribute to a future revision, please drop me a note.
Also, the original author, Ray Brigleb.
Lastly, http://google.com/linux, who saved me much time with their incredible repository of information. Use it to answer questions not answered here!
Copyright � 2002, Hal Burgiss.
"X Window System" is a trademark of the X Consortium, Inc [now the OpenGroup?].
"XFree86" is a trademark of The XFree86 Project, Inc.
"Linux" is a Registered Trademark of Linus Torvalds.
xdm - the X Display Manager. |
xfs - the X Font Server. |
twm - a lightweight Window Manager. |
xterm - the best known terminal emulator. Also, xterm3d and nxterm. |
xwd - a screen and window image capturer. |
xf86config - X server configuration utility. |
xdpyinfo - X display information utility. This shows great detail about the X server. |
xlsclients - lists currently connected X server clients. |
xlsfonts - lists fonts available to X. |
appres - lists the X "resources" that a program will use. |
xfontsel - an application for viewing or selecting fonts. |
xprop - a tool for displaying window "properties", such as the Class name of the client. |
xset - sets user preferences for many things, including mouse, keyboard, sound (bell), etc. |
xsetroot - a program for changing the "root window" appearance, e.g. setting a background color. |
xvidtune - an application to adjust X server video modes and monitor related settings. |
xwininfo - displays information about a selected "window". |
xmodmap - a utility for manipulating keyboard and mouse button mappings. |
Many, many fonts. And quite a bit of documentation as well. |
The X server controls both input (keyboard, mouse, etc) and output (display, monitor) devices.
Video cards - This is much tougher. The X server is determined by the the chipset. Many, many are supported. But inevitably there are always some newer cards, or even revised cards, that are not. And some may have better support and better optimization than others. Advanced features such as multi-headed displays, 3D, TV out, DRI, etc., have some support as well, though this should be researched first, as the support may be limited. Supported cards are listed: http://xfree86.org/cardlist.html.
Open source drivers are often developed incrementally. For instance, a particular card may work well for basic display purposes, but specialized features such as 3D may come much later in the development cycle. This is a quite different development model than with proprietary drivers from the manufacturer.
Keyboards -- Any standard PC type keyboard should do fine, including PS/2, USB and many infra-red devices. Probably many "non-standard" ones too ;-)
Mice and other pointer devices -- Most should be supported including PS/2, bus, serial, USB and many infra-red devices. Optical mice also. Unix has long preferred three button mice, though more buttons is supported as well. Many wheeled mice have X server support via the "IMPS/2" (IntelliMouse), or other specific protocols, though may require supplemental configuration for some individual applications. (See the Links section.)
Laptops have their own unique set of problems since the hardware tends to be very specialized, and often different from what is commonly found on desktop style systems. X is supported by many. Check for details at http://www.linux-laptop.net/.
You can check the "hardware compatibility list" at your distribution's web site too. This should give a very good idea of what should work with your release.
Newer versions of XFree86 obviously will have better hardware support. If you are using an older Linux version and don't have full hardware support, see about upgrading XFree86. Check first to see if your distribution has updates for your release.
XF86Config file defines hardware devices, and other critical components of the X server environment.
This file contains various "sections". Each section defines some fundamental aspect of XFree86, such as "InputDevice" (mouse, keyboard, joystick, etc), "monitor", or "screen". The XF86Config man page describes the sections and common values for each. Note that the values listed in the man page is not a comprehensive listing. There are many device specific "options". Check http://xfree86.org for notes and tips on your hardware.
The author's current XF86Config-4, as generated by Red Hat's installer for XFree86 4.1:
Section "ServerLayout" Identifier "XFree86 Configured" Screen 0 "Screen0" 0 0 InputDevice "Mouse0" "CorePointer" InputDevice "Keyboard0" "CoreKeyboard" EndSection Section "Files" # The location of the RGB database. RgbPath "/usr/X11R6/lib/X11/rgb" # Multiple FontPath entries are allowed (they are concatenated together) # By default, Red Hat 6.0 and later now use a font server independent of # the X server to render fonts. FontPath "unix/:7100" EndSection # Module loading section Section "Module" Load "dbe" # Double-buffering Load "GLcore" # OpenGL support Load "dri" # Direct rendering infrastructure Load "glx" # OpenGL X protocol interface Load "extmod" # Misc. required extensions Load "v4l" # Video4Linux # Load "fbdevhw" Load "pex5" Load "record" Load "xie" EndSection Section "InputDevice" Identifier "Keyboard0" Driver "keyboard" Option "XkbLayout" "us" # Option "AutoRepeat" "500 5" # when using XQUEUE, comment out the above line, and uncomment the # following line # Option "Protocol" "Xqueue" # Specify which keyboard LEDs can be user-controlled (eg, with xset(1)) # Option "Xleds" "1 2 3" # To disable the XKEYBOARD extension, uncomment XkbDisable. # Option "XkbDisable" # To customize the XKB settings to suit your keyboard, modify the # lines below (which are the defaults). For example, for a non-U.S. # keyboard, you will probably want to use: # Option "XkbModel" "pc102" # If you have a US Microsoft Natural keyboard, you can use: # Option "XkbModel" "microsoft" EndSection Section "InputDevice" Identifier "Mouse0" Driver "mouse" Option "Device" "/dev/mouse" Option "Protocol" "IMPS/2" Option "Emulate3Buttons" "off" Option "ZAxisMapping" "4 5" EndSection Section "Monitor" Identifier "Sylvania F74" VendorName "Unknown" ModelName "Unknown" HorizSync 30 - 70 VertRefresh 55 - 120 Option "dpms" # Modelines go here if necessary. Use xvidtune to get proper values. EndSection Section "Device" Identifier "ATI Rage 128" Driver "r128" BoardName "Unknown" EndSection Section "Device" Identifier "Linux Frame Buffer" Driver "fbdev" BoardName "Unknown" EndSection Section "Screen" Identifier "Screen0" Device "ATI Rage 128" Monitor "Sylvania F74" DefaultDepth 24 Subsection "Display" Depth 24 Modes "1400x1050" "1280x1024" "1152x864" "1024x768" "800x600" EndSubSection Subsection "Display" Depth 16 Modes "1600x1200" "1400x1050" "1280x1024" "1152x864" "1024x768" "800x600" EndSubSection Subsection "Display" Depth 8 Modes "1024x768" "800x600" "640x480" EndSubSection EndSection Section "DRI" Mode 0666 EndSection |
Yours may look quite different. This is just one possible configuration with gratuitous comments from Red Hat (and me), and is for a fairly ordinary set up. There is nothing exotic here like multiple screens or displays.
It is beyond the scope of this document to explain this in detail. See the XF86Config man page. Also, consider visiting xfree86.org and look for specific options that might apply to your card or other hardware.
Just one quick note on the "Screen" section above. Notice there are three sub-sections, identified as "Display". Each sub-section has a different "Depth" specified, (a.k.a. ColorDepth). The "Modes" also vary somewhat according to the respective "Depth" setting. The active "Display" sub-section that will be used, is determined by the "DefaultDepth" setting (unless over-ridden by command line options). The default in this example is defined as "24", so the first sub-section will be used. Also, the highest "Mode" listed in this sub-section will be the default mode (resolution), which here is the first one listed. The first listed mode also determines the viewable screen area, which can be smaller than the mode (resolution) itself. In which case, you would have a virtual desktop that is larger than the viewable screen. To have the viewable screen, and resolution match, have the largest value as the first value listed for each "Mode".
Another note on the "Modes" here: what you see is the result of my choices during Red Hat's Xconfigurator's configuration. These are standard resolutions, but do not have to be! This is only limited by what your hardware can support. And you don't have to use standard width x height ratios either. Something like 1355x1112 is a valid setting (if your hardware supports it and it floats your boat!).
The X server will reject any "Modes" it thinks are invalid. You can cycle through valid modes to change screen resolution with Ctrl-Alt-+ and Ctrl-Alt-- (that's the keypad plus and minus keys).
In versions prior to v4.x, you would also see many "Modeline" statements that attempted to define the monitor's capabilities. These statements would look something like:
# 1024x768 @ 100Hz, 80.21 kHz hsync Modeline "1024x768" 115.5 1024 1056 1248 1440 768 771 781 802 -HSync -VSync |
Explicit "Modeline" definitions are not required as of 4.x ;-) This sometimes required hand editing to get optimal values in earlier versions of XFree86, though is generally not necessary with v4.x. The XFree86 Video Timings HOWTO, http://www.linuxdoc.org/HOWTO/XFree86-Video-Timings-HOWTO/index.html has a nice, but rather technical, explanation of this.
If whatever configuration utility you are using, does not automatically recognize your video card or monitor specifications correctly, you are unlikely to get an optimal configuration. In such cases, you may have to manually supply the correct values. This should be available from your owner's manual (you kept that, right?). Or, check the manufacturer's web site.
Again, hand editing of this file is generally unnecessary. Should you decide this is indeed necessary, be careful. One small error may cause X to fail. Any changes to this file will require restarting X for the changes to take effect.
Using somebody else's XF86Config file, is generally a bad idea since they are unlikely to have identical hardware.
Vendor: Unknown, Model: Unknown Num hsync: 1, Num vsync: 1 hsync range 0: 30.00 - 70.00 vsync range 0: 55.00 - 120.00 "1400x1050" 122.00 1400 1488 1640 1880 1050 1052 1064 1082 +hsync +vsync |
The last line is the "Modeline" being used to drive the current screen. See The XFree86 Video Timings HOWTO, http://www.linuxdoc.org/HOWTO/XFree86-Video-Timings-HOWTO/index.html, for more on "Modelines".
You can test modifications, and apply them to the current session. For changes to be made permanent, they will have to be added manually to the "Monitor" section of XF86Config (or XF86Config-4 for v.4.x) with a text editor.
xvidtune will dutifully warn of you of the hazards of playing with the monitor settings. It is unlikely you can hurt anything with modern monitors. But it is best used to make minor adjustments. Use at your own risk!
# Run xdm in runlevel 5 x:5:respawn:/etc/X11/xdm -nodaemon |
xterm -geometry +1+1 -n login -display :0 |
X :0 |
startx -- -dpi 100 -depth 16 #force X to 100 dots per inch #and colordepth of 16 (X v4 syntax) |
#!/bin/sh # $XConsortium: xinitrc.cpp,v 1.4 91/08/22 11:41:34 rws Exp $ userresources=$HOME/.Xresources usermodmap=$HOME/.Xmodmap # merge in defaults and keymaps if [ -f $userresources ]; then xrdb -merge $userresources fi if [ -f $usermodmap ]; then xmodmap $usermodmap fi if [ -z "$BROWSER" ] ; then # we need to find a browser on this system BROWSER=`which netscape` if [ -z "$BROWSER" ] || [ ! -e "$BROWSER" ] ; then # not found yet BROWSER= fi fi if [ -z "$BROWSER" ] ; then # we need to find a browser on this system BROWSER=`which lynx` if [ -z "$BROWSER" ] || [ ! -e "$BROWSER" ] ; then # not found yet BROWSER= else BROWSER="xterm -font 9x15 -e lynx" fi fi export BROWSER # start some nice programs if [ -f $HOME/.Xclients ]; then exec $HOME/.Xclients else xclock -geometry 50x50-1+1 & xterm -geometry 80x50+494+51 & if [ -f /usr/X11R6/bin/fvwm ]; then exec fvwm else exec twm fi fi #eof |
#!/bin/bash # ~/.Xclients, start my programs. xset s off s noblank xset m 30/10 4 xset r rate 200 40 xscreensaver & rxvt -geometry 80x50-50+150 & echo Starting Window Manager... if [ -x /usr/X11R6/bin/wmaker ]; then echo `date`: Trying /usr/X11R6/bin/wmaker... |tee -a ~/.wm-errors 2>&1 exec /usr/X11R6/bin/wmaker >> ~/.wm-errors 2>&1 fi echo `date`: Failed, trying fvwm... |tee -a ~/.wm-errors 2>&1 # let's try regular fvwm (AnotherLevel doesn't work with fvwm1). if [ -n "$(type -path fvwm)" ]; then # if this works, we stop here exec fvwm >> ~/.wm-errors 2>&1 fi echo `date`: Failed, trying twm... |tee -a ~/.wm-errors 2>&1 # wow, fvwm isn't here either ... # use twm as a last resort. exec twm >> ~/.wm-errors 2>&1 # Dead in the water here, X will exit as well, sigh... echo `date`: Unable to start a Window Manager ... |tee -a ~/.wm-errors 2>&1 # eof |
Display managers really do much more than enable GUI style log-ins. They are also used to manage local as well as remote "displays" on a network. We won't get into details on this here, but it is nicely covered in the Remote X Apps Mini HOWTO and the XDMCP HOWTO (see the links section). For our purposes here, they provide similar services to getty and login, which allow users to log into a system and start their default shell, but in a GUI environment.
Here is an example of a more advanced usage of what else a display manager might be used for, from Diego Zamboni:
I have two X sessions running with different resolutions. I switch between them depending on whether my laptop is connected to an external monitor or using its own LCD display.
Here's my /usr/lib/X11/xdm/Xservers file that initiates both displays:
:1 local /usr/X11R6/bin/X :1 -layout 1024x768 :0 local /usr/X11R6/bin/X :0 -layout 1600x1200Then I have "1024x768" and "1600x1200" defined as "server layouts" in my /etc/X11/XF86Config-4, as follows:
Section "ServerLayout" Identifier "1600x1200" Screen "Screen0" 0 0 InputDevice "Mouse0" "CorePointer" InputDevice "Keyboard0" "CoreKeyboard" EndSection Section "ServerLayout" Identifier "1024x768" Screen "Screen1" 0 0 InputDevice "Mouse0" "CorePointer" InputDevice "Keyboard0" "CoreKeyboard" EndSection ## snip ... Section "Screen" Identifier "Screen0" Device "S3 Savage/MX" Monitor "Monitor0" DefaultDepth 16 Subsection "Display" Depth 16 Modes "1600x1200" "1280x1024" "1024x768" EndSubsection EndSection Section "Screen" Identifier "Screen1" Device "S3 Savage/MX" Monitor "Monitor0" DefaultDepth 16 Subsection "Display" Depth 16 Modes "1024x768" "800x600" EndSubsection EndSection
Note the use of "Identifiers" here. Diego is starting two separate "displays" here. Then he can choose which one he wants when he logs in.
Most display managers are derived from XFree86's venerable xdm, and add their own enhancements. Let's look at the most popular ones briefly.
! $XConsortium: xdm-conf.cpp /main/3 1996/01/15 15:17:26 gildea $ DisplayManager.errorLogFile: /var/log/xdm-errors DisplayManager.servers: /etc/X11/xdm/Xservers DisplayManager.accessFile: /etc/X11/xdm/Xaccess ! All displays should use authorization, but we cannot be sure ! X terminals will be configured that way, so by default ! use authorization only for local displays :0, :1, etc. DisplayManager._0.authorize: true DisplayManager._1.authorize: true ! The following three resources set up display :0 as the console. DisplayManager._0.setup: /etc/X11/xdm/Xsetup_0 DisplayManager._0.startup: /etc/X11/xdm/GiveConsole DisplayManager._0.reset: /etc/X11/xdm/TakeConsole ! DisplayManager*resources: /etc/X11/xdm/Xresources DisplayManager*session: /etc/X11/xdm/Xsession ! ! 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 |
:0 local /usr/X11R6/bin/X |
#!/bin/sh xconsole -geometry 480x100-0-0 -daemon -notify -verbose -fn \ '-schumacher-clean-medium-r-*-*-10-*-*-*-*-*-*-*' -exitOnFail & /usr/X11R6/bin/xv -quit -root /usr/share/pixmaps/Backgrounds/InDreams.jpg \ || xsetroot -solid darkblue |
#if WIDTH > 800 xlogin*greetFont: -adobe-helvetica-bold-o-normal--24-240-75-75-p-138-iso8859-1 xlogin*font: -adobe-helvetica-medium-r-normal--18-180-75-75-p-103-iso8859-1 xlogin*promptFont: -adobe-helvetica-bold-r-normal--18-180-75-75-p-103-iso8859-1 xlogin*failFont: -adobe-helvetica-bold-r-normal--18-180-75-75-p-103-iso8859-1 #else xlogin*greetFont: -adobe-helvetica-bold-o-normal--17-120-100-100-p-92-iso8859-1 xlogin*font: -adobe-helvetica-medium-r-normal--12-120-75-75-p-69-iso8859-1 xlogin*promptFont: -adobe-helvetica-bold-r-normal--12-120-75-75-p-69-iso8859-1 xlogin*failFont: -adobe-helvetica-bold-o-normal--14-140-75-75-p-82-iso8859-1 #endif |
[servers] 0=/usr/bin/X11/X #1=/usr/bin/X11/X |
GNOME includes the gdmconfig utility to control many aspects of gdm behavior.
xterm -bg blue & |
The basic X resource syntax is expressed like:
<program><binding><widget><binding><widget><...><resource>:<value> |
Which, in real life, typically looks something like:
xterm*fontMenu*background: darkblue |
xterm*background: darkblue |
*background: darkblue |
! $XFree86$ #include "XTerm" *VT100*colorMode: on *VT100*dynamicColors: on ! Uncomment this use color for underline attribute !*VT100*colorULMode: on !*VT100*underLine: off ! Uncomment this to use color for the bold attribute !*VT100*colorBDMode: on *VT100*color0: black *VT100*color1: red3 *VT100*color2: green3 *VT100*color3: yellow3 *VT100*color4: blue3 *VT100*color5: magenta3 *VT100*color6: cyan3 *VT100*color7: gray90 *VT100*color8: gray30 *VT100*color9: red *VT100*color10: green *VT100*color11: yellow *VT100*color12: blue *VT100*color13: magenta *VT100*color14: cyan *VT100*color15: white *VT100*colorUL: yellow *VT100*colorBD: white |
Xresources files are read into the resource database with the xrdb command. Example:
xrdb -merge ~/.Xresources |
! This is a comment ;-) #ifdef COLOR *customization: -color #endif !! Let's cast a wide net, for any app supporting these ! Blink instead of beeping *visualBell: True *scrollTtyOutput: False *scrollKey: True ! See Netscape.ad for many settable resources Netscape*noAboutSplash: True Netscape*documentFonts.sizeIncrement: 5 Netscape*documentFonts.xResolution*iso-8859-1: 120 Netscape*documentFonts.yResolution*iso-8859-1: 120 netscape-navigator*geometry: 960x820+240+140 emacs*Background: DarkBlue emacs*Foreground: Wheat emacs*pointerColor: Orchid emacs*cursorColor: Orchid emacs*bitmapIcon: on emacs*font: 10x20 ! GVim colors, etc !! GTK versions of gvim will not use all these. Vim*useSchemes: all Vim*sgiMode: true Vim*useEnhancedFSB: true Vim.foreground: Black !Vim.background: lightyellow2 Vim*background: white ! geometry: width x height Vim.geometry: 88x40 Vim*font: -misc-fixed-medium-r-normal--20-200-75-75-c-100-iso8859-15-*5 Vim*menuBackground: yellow Vim*menuForeground: black rxvt*backspacekey: ^? rxvt*background: Black rxvt*foreground: wheat rxvt*cursorColor: Orchid rxvt*geometry: 100x18+40+300 rxvt*title: Linux rxvt*reverseVideo: false !rxvt*backgroundPixmap: ~/penguinitis.xpm rxvt*scrollBar: true rxvt*reverseWrap: true rxvt*font: -*-lucidatypewriter-medium-*-*-*-14-*-*-*-*-*-*-* rxvt*fullCursor: true rxvt*saveLines: 1500 rxvt*menu: ~/rxvt.menu XTerm*saveLines: 1500 ! Do not clear the screen after the program exits XTerm*VT100*titeInhibit: true ! Fix up xterm's keybindings xterm*VT100.translations: #override \ <Key>BackSpace: string(0x7F) \n\ <Key>Insert: string(0x1b) string("[2~")\n\ <Key>Delete: string(0x1b) string("[3~")\n\ <Key>Home: string(0x1b) string("[1~")\n\ <Key>End: string(0x1b) string("[4~")\n\ <Key>Page_Up: string(0x1b) string("[5~")\n\ <Key>Page_Down: string(0x1b) string("[6~")\n\ <KeyPress>Prior : scroll-back(1,page)\n\ <KeyPress>Next : scroll-forw(1,page) ! Ghostview Ghostview*Font: *-helvetica-bold-r-normal--12-*-*-*-*-*-* Ghostview*BorderColor: white Ghostview*Text*Font: rk14 Ghostview*Background: #d9d9d9 !Ghostview*Foreground: white ghostview.form.pageview.page.background: white ghostview.form.pageview.page.foreground: black .ghostview.zoom.form.page.background: white .ghostview.zoom.form.page.foreground: black ! xscreensaver ! ! Time out after 12 minutes, cycle mode after each 2 xscreensaver.timeout: 12 xscreensaver.cycle: 5 ! Run low priority, and fade between modes xscreensaver.nice: 12 xscreensaver.fadeSeconds: 2 XFontsel.menu.options.showUnselectable: False |
Section "InputDevice" Identifier "Keyboard0" Driver "keyboard" Option "XkbLayout" "us" EndSection |
Setting up international keyboards in nicely discussed in http://www.linuxdoc.org/HOWTO/mini/Intkeyb/index.html. Also, a search of http://google.com/linux will turn up many creative examples.
The man page has many brief examples of various usages. Here is what an one hypothetical ~/.Xmodmap might look like:
! /home/hal/.Xmodmap, last change 10/03/01 ! ! Force backspace to 22 and Delete to 111 keycode 22 = BackSpace keycode 111 = Delete ! ! My keyboard handles right and left Alt differently. Make the ! Right act like the Left to avoid digital gymnastics. keycode 63 = Alt_L keycode 113 = Meta_L ! ! Hard-code the keypad to numeric values as if numlock is always on ! since I never use it for anything else. keycode 79=7 keycode 80=8 keycode 81=9 keycode 83=4 keycode 84=5 keycode 85=6 keycode 87=1 keycode 88=2 keycode 89=3 keycode 90=0 keycode 91=period keycode 86 = plus ! deactivate Num_Lock key since we don't need it now. keycode 77 = ! ! My capslock is next to tab. I hit it by mistake sometimes, ! and don't use it anyway. So make capslock act like Tab. keycode 66 = Tab clear lock ! ! Reverse mouse buttons for left-handed people pointer = 3 2 1 |
As with many XFree86 files, the "!" represents a comment. Another possible use, is to redefine those annoying "Windows" keys to something useful. Hopefully this gives an idea of some things one might want to do to make the keyboard more agreeable to us.
Speaking of the Numlock key, X will typically disable this when it starts up. No matter how you have the BIOS set up, or Linux set up before X starts. So the trick above is one way. There is also a utility available as either numlockx, or setnumlock, that can be found on the 'Net, if your distribution does not include one or the other. This can be put in a start up file to turn Numlock on automatically if you'd prefer.
Window Managers and Desktop Environments will also allow customization of the keyboard and mouse (as long as it is recognized correctly by X). This may be an easier way to configure certain customizations.
Section "InputDevice" Identifier "Mouse0" Driver "mouse" Option "Device" "/dev/mouse" Option "Protocol" "PS/2" Option "Emulate3Buttons" "on" EndSection |
# Turn off screen blanking xset s off # Enable DPMS energy saving xset +dpms # Tweak the rodent xset m 30/10 4 # Speed up keyboard xset r rate 200 40 |
Understanding fonts and colors can be more complex in X than on other platforms.
FontPath "/usr/X11R6/lib/X11/fonts/misc:unscaled" FontPath "/usr/X11R6/lib/X11/fonts/100dpi:unscaled" FontPath "/usr/X11R6/lib/X11/fonts/75dpi:unscaled" FontPath "/usr/X11R6/lib/X11/fonts/Type1" FontPath "/usr/X11R6/lib/X11/fonts/misc" FontPath "/usr/X11R6/lib/X11/fonts/100dpi" FontPath "/usr/X11R6/lib/X11/fonts/75dpi" |
FontPath "unix/:7101" |
Example: Preparing fonts, and re-initializing font server after adding new fonts:
su <password> mkfontdir /usr/X11R6/lib/X11/fonts/my_new_fonts/ /etc/init.d/xfs restart |
su <password> mkfontdir /usr/X11R6/lib/X11/fonts/my_new_fonts/ xset +fp /usr/X11R6/lib/X11/fonts/my_new_fonts/ xset fp rehash |
The "xset +fp" would not be necessary if the directory is already part of the FontPath.
-adobe-helvetica-medium-r-normal-*-*-120-*-*-p-*-iso10646-1 |
Where each field, left to right is:
fndry - font foundry, the company or individual which made the font. |
fmly - font family, the popular nickname of the font |
wght - font weight (bold, medium, etc.) |
slant - font slant (italics, oblique, roman (normal), etc.) |
sWdth - font width (normal, condensed, extended, etc.) |
adstyl - additional style (sans serif, serif, etc.) |
pxlsz - pixel size, the number of pixels vertically in a character |
ptSz - approximate point size of the text (similar to pxlsz) |
resx - horizontal resolution, in dpi |
resy - vertical resolution, in dpi |
spc - spacing, only useful, apparently, in the Schumacher fonts |
avgWidth - average character width of the font |
rgstry - the recognized registry that lists the font |
encdng - nationality encoding |
KDE and GNOME have their own utilities that are not quite as obtuse ;-)
Type 1 fonts, most commonly used in conjunction with PostScript document formats, are the traditional standard in Unix and Linux environments. You should have a reasonably good starter selection installed already. Or, more can be found for free on the Internet with considerable ease, and Try ftp://ftp.cdrom.com/pub/os2/fonts/ for starters. Type 1 are scalable fonts, and have many of the same benefits of the better known TrueType fonts. If you don't have a good selection of TrueType fonts installed, then Type 1 is what you want for most GUI applications. But again, this is not standard on other platforms, and can present problems when viewing documents (e.g. web pages) that are designed with "other platforms" in mind.
TrueType fonts started with Apple, and later were licensed by Microsoft. So people migrating from non-Unix platforms are already familiar with these high quality fonts. Unfortunately, there are not many quality TrueType fonts under a suitable license, and thus there are not many included with Linux distributions. And the ones that are, often are not as high quality. Also unfortunately, TrueType has become somewhat of a standard on the Web and in other venues, and not having good TrueType fonts can be a detriment. XFree86 also seems to render TrueType a little better than Type1.
That's the bad news. The good news is that any TrueType font included with any version of Windows, or any Windows applications, should work on Linux. Though you will have to take some additional steps to integrate them. This particularly helps web browsing where X's bitmapped fonts just don't scale well.
We won't go into detail on installing and configuring these fonts here, as it is addressed in depth in other documents. See The Font HOWTO , http://www.linuxdoc.org/HOWTO/Font-HOWTO.html, for general font information, and Type 1 tips. See The Font De-Uglification Mini HOWTO, http://www.linuxdoc.org/HOWTO/mini/FDU/index.html, for various X related font tips, especially TrueType.
xterm -fg DarkSteelBlue1 -bg red3 & |
176 226 255 LightSkyBlue1 164 211 238 LightSkyBlue2 141 182 205 LightSkyBlue3 96 123 139 LightSkyBlue4 202 225 255 LightSteelBlue1 188 210 238 LightSteelBlue2 162 181 205 LightSteelBlue3 110 123 139 LightSteelBlue4 191 239 255 LightBlue1 178 223 238 LightBlue2 154 192 205 LightBlue3 104 131 139 LightBlue4 |
Desktop Environments will have a GUI utility for selecting colors.
Some of the most popular Window Managers:
aewm: http://www.red-bean.com/~decklin/aewm/ |
AfterStep: http://www.afterstep.org/ |
BlackBox: http://sourceforge.net/projects/blackboxwm |
Enlightenment: http://www.enlightenment.org/pages/main.html |
Fluxbox: http://fluxbox.sourceforge.net/ |
fvwm: http://www.fvwm.org/ |
IceWM: http://www.icewm.org/ |
olwm (OpenLook Window Manager): http://www.plig.org/xwinman/olvwm.html |
Sawmill: http://sawmill.sourceforge.net/ |
WindowMaker: http://www.windowmaker.org/ |
XFce: http://xfce.org/ |
There are many, many lesser known ones as well. http://www.plig.org/xwinman/ has an updated list of Window Managers, and related information. There is always freshmeat too.
GNOME and KDE both have their default Window Manager, but support other, compliant Window Managers as well. Your distribution probably has included at least several. Try them all if you don't already have a favorite. Your distribution probably also has a method of switching dynamically between Window Managers (and Desktop Environments too).
There is a trade-off in this additional functionality, and that is that it takes memory and system resources to oversee all this. If you have plenty of memory and a fast computer, this is no problem. But in low memory situations, this can cause a slowdown (see the performance section below). 64M of RAM is probably borderline with either KDE or GNOME.
So do you need a Desktop Environment? That is up to the user. They are certainly not required to run X, but do add features that many users want or expect in a GUI. Which one is better? Ah, but that is up to you to decide!
KDE has been around longer than GNOME, and some would say maybe a little more mature. KDE is based on the QT widget toolkit. A quote from the KDE home page:
KDE is a powerful Open Source graphical desktop environment for Unix workstations. It combines ease of use, contemporary functionality, and outstanding graphical design with the technological superiority of the Unix operating system.
KDE is a mature desktop suite providing a solid basis to an ever growing number of applications for Unix workstations. KDE has developed a high quality development framework for Unix, which allows for the rapid and efficient creation of applications.
GNOME is based on the GTK+ toolkit. And a quote from the GNOME home page:
GNOME stands for GNU Network Object Model Environment. The GNOME project intends to build a complete, user-friendly desktop based entirely on free software. GNOME is part of the GNU project, and GNOME is part of the Open Source(tm) movement. The desktop will consist of small utilities and larger applications which share a consistent look and feel. GNOME uses GTK+ as the GUI toolkit for all GNOME-compliant applications.
XFce is a lighter weight, less featureful Desktop Environment that does not get as much attention as the others. XFce is also based on the GTK+ toolkit. And a quote from the XFce home page:
The XFce project was first started because I needed a simple, light and efficient environment for my Linux System.
I believe that the desktop environment should be made to increase user productivity. Therefore, the goal is keep most system resources for the applications, and not to consume all memory and CPU usage with the desktop environment.
All these have their own extensive documentation. If you can't find what you need installed on your system, check the respective home pages.
The font to use for displaying the text in your window (see font section below).
The color to use for the window background. Typically this is a "color name" (see below).
The color to use for the window foreground (i.e. fonts, etc).
$ gnome-terminal --usage Usage: gnome-terminal [-?] [--disable-sound] [--enable-sound] [--espeaker=HOSTNAME:PORT] [--version] [--usage] [--gdk-debug=FLAGS] [--gdk-no-debug=FLAGS] [--display=DISPLAY] [--sync] [--no-xshm] [--name=NAME] [--class=CLASS] [--gxid_host=HOST] [--gxid_port=PORT] [--xim-preedit=STYLE] [--xim-status=STYLE] [--gtk-debug=FLAGS] [--gtk-no-debug=FLAGS] [--g-fatal-warnings] [--gtk-module=MODULE] [--disable-crash-dialog] [--sm-client-id=ID] [--sm-config-prefix=PREFIX] [--sm-disable] [--tclass=TCLASS] [--font=FONT] [--nologin] [--login] [--geometry=GEOMETRY] [-e COMMAND] [-x COMMAND] [--foreground=COLOR] [--background=COLOR] [--solid] [--pixmap=PIXMAP] [--bgscroll] [--bgnoscroll] [--shaded] [--noshaded] [--transparent] [--utmp] [--noutmp] [--wtmp] [--nowtmp] [--lastlog] [--nolastlog] [-t TITLE] [--icon=ICON] [--termname=TERMNAME] [--start-factory-server] [--use-factory] |
Both X networking and security are nicely covered in The Remote X Apps Mini HOWTO, http://www.linuxdoc.org/HOWTO/mini/Remote-X-Apps.html, so we won't need to try to rehash it here. Recommended reading. See other references in the Links section of the Appendix below.
A few recommended precautions:
Never, ever run X as root. The number of bad things that can happen, dramatically increases when logged in as root. Learn to run as much as possible as a regular user, and su to root only when needed. This may sound like a lot of extra work (and probably is at first), but once the "right" way of doing things is learned, it soon becomes second nature.
A brief anecdote from a friend: he had a client who's new system stopped "working". Curiously, he found the entire /dev directory was missing, which he re-installed and all was well again. He was back a few days later and found the system logged in as root to X, and someone had clicked on /dev in the file manager, and dragged it onto the desktop. Smooth move!
If you ever connect to a network with untrusted users, be sure to have a firewall between you and them. This goes double for the Internet. Firewalling is beyond the scope of this document, but is covered in many other places, including your vendor's website. http://linuxdoc.org has several security HOWTOs that can help as well. http://linuxsecurity.com/docs/ is another good place to look.
You can disable TCP connections with the "-nolisten tcp" command line X server switch. This does not help for local connections though. For xinit/startx:
exec X :0 -dpi 100 -nolisten tcp |
Placed in ~/.xserverrc. And for xdm, in /usr/lib/X11/xdm/Xservers:
:0 local /usr/X11R6/bin/X :0 -nolisten tcp |
The definitive source of information on XFree86 is, of course, http://xfree86.org. Don't forget the man pages that you have installed already too (X, Xserver, XF86Config, XFree86, xdm, xinit, xmodmap, startx, xauth, Xsecurity, etc, etc). These are really mostly decent, though some are quite technical.
Some pages at xfree86.org to check:
Docs and support info: http://www.xfree86.org/support.html for various versions and topics. |
README: http://www.xfree86.org/current/README.html |
Release Notes: http://www.xfree86.org/current/RELNOTES.html |
DRI: http://www.xfree86.org/current/DRI.html |
Status: http://www.xfree86.org/current/Status.html |
Mouse: http://www.xfree86.org/current/mouse.html |
Supported card list: http://xfree86.org/cardlist.html |
Other related documents from LDP:
If you are just starting out, you may find the X Window System Architecture Overview HOWTO, http://www.linuxdoc.org/HOWTO/XWindow-Overview-HOWTO/ to be helpful. It covers all the basic concepts quite well.
The Remote X Apps Mini HOWTO, http://www.linuxdoc.org/HOWTO/mini/Remote-X-Apps.html, does a nice job of discussing running X remotely, and related security issues of X networking.
The XDMCP HOWTO, http://www.linuxdoc.org/HOWTO/XDMCP-HOWTO/index.html, covers the X Display Manager Control Protocol, for running X remotely. Also, The XDM and X Terminal mini-HOWTO, http://www.linuxdoc.org/HOWTO/mini/XDM-Xterm/index.html.
The XFree86 HOWTO, http://www.linuxdoc.org/HOWTO/XFree86-HOWTO/index.html, succinctly covers installation, and initial configuration.
The XFree86 Video Timings HOWTO, http://www.linuxdoc.org/HOWTO/XFree86-Video-Timings-HOWTO/index.html, gets down and dirty with the finer points of monitor tuning. Generally not required for XFree86 v4.x.
The Xinerama HOWTO, http://www.linuxdoc.org/HOWTO/Xinerama-HOWTO.html, covers multi-headed displays.
The Font HOWTO, http://www.linuxdoc.org/HOWTO/Font-HOWTO.html, covers various font topics.
The Font De-Uglification Mini HOWTO, http://www.linuxdoc.org/HOWTO/mini/FDU/index.html, covers a range of X font issues.
The International Keyboard HOWTO; http://www.linuxdoc.org/HOWTO/mini/Intkeyb/index.html
The Linux Infrared HOWTO: http://www.linuxdoc.org/HOWTO/Infrared-HOWTO/index.html
Looking for information on a Window Manager, or wanting to try something new or different: http://www.plig.org/xwinman/
Wheel mice tips and configuration: http://koala.ilog.fr/colas/mouse-wheel-scroll/
Linux and Laptops: http://www.linux-laptop.net/
The O'Reilly series on X Window! Visit http://www.ora.com/ for the definitive books on X.
The X Consortium's web site is http://www.x.org/ ... or perhaps it's moved to http://www.opengroup.org/.
http://www.x11.org/ is sort of a clearinghouse for all things X.
And for everything else under the Sun: http://google.com/linux/. An incredible resource in its own right.