Craig's Linux Notes: X

Last modified: 04/03/2007

Contents

What is X?
XFree86 Log
Access
Zapping
tmpwatch
DRI and GLX
Security
Fonts
Some font sources
FontConfig
Ghostscript
xfs
Adding fonts to OpenOffice
Gamma adjustment

What is X?

Simply put, X is a standard system for drawing stuff on computer screens. If you are reading this page on either a Unix or Macintosh system, you are most likely using X.

X is an open standard. Several different implementations are available.

X was designed for remote display. That means the computer figuring out what to draw can be different than the one the screen is plugged in to. The terminology for X can be a little confusing, so here it is: an X Server is the part that owns the screen. The X Client knows what to draw, but doesn't own the screen, and so must ask the X server to draw its stuff. The X Server and X Client may be running on different computers. For more details on how to do this, set the DISPLAY variable on the X client -- see man X and man xhost for details.

X is not a window manager. While X can draw basic windows, the fancy gizmos that give you multiple desktops, control menus, and beautiful skins are part of add-on software called the window manager. There are more of these than there are X implementations, and they vary in complexity and features.

XFree86 Log


Gentoo Logo The Xorg log is /var/log/Xorg.0.log (run man Xorg for details).
Red Hat Logo The XFree86 log is /var/log/XFree86.0.log (run man XFree86 for details).

Access

XAUTHORITY=/home/current-X-user/.Xauthority
DISPLAY=:0

Zapping

You can restart your X session with Ctrl+Alt+Backspace, which means that all of your windows are closed and then X restarts. This feature allows you to regain control of your system when something has gone wrong. But it can be very annoying if you type that key combination accidentally, and usually it doesn't help when you need it because your keyboard is locked-up, too. I find it more convenient to disable it altogether by adding this to my X configuration file, /etc/X11/xorg.conf:

Section "ServerFlags"
Option "DontZap" "on"
EndSection

Also see Gentoo TIP Fix the Login Security Hole.

tmpwatch

X creates a pipe called /tmp/.X11-unix/X0 and it is used to open new windows. The modification time on it never changes, so if you have mounted /tmp with noatime, and have tmpwatch remove things by modification time, then are after a few days tmpwatch will delete it -- and then you can't open new windows! A couple other things create sockets in /tmp, and are likely to stop working around the same time. You can see list of all programs currently using the sockets in /tmp with netstat --unix --program | grep tmp | less.

How to recover: forget it! Restart X and the other daemons. Best to put system in runlevel 1 and kill all non-root processes.

Prevention: Do not use the --all option with tmpwatch.

DRI and GLX

Section "Module"
...
# Load  "dri"
...
EndSection

Security

[servers]
0=/usr/bin/X11/X -nolisten tcp
[server-Standard]
name=Standard server
command=/usr/X11R6/bin/X -nolisten tcp
flexible=true

[server-Terminal]
name=Terminal server
command=/usr/X11R6/bin/X -terminate -nolisten tcp
flexible=false
handled=false
Also see Xserver(1), XFree86(1), X(7x), and Bill Moss' page.

Fonts

Some font sources

FontConfig

Gentoo Logo Gentoo uses FontConfig. To add new fonts, either Type1 or TrueType:
  1. Create a subdirectory under one of the directories listed at the top of "/etc/fonts/fonts.conf". Example: /usr/share/fonts/cheapskate.
  2. Put fonts in the directory.
  3. That's it! FontConfig figures out when fonts are added or removed. You can list known fonts with "fc-list | sort | less"

Ghostscript

Gentoo Logo Adding fonts to Ghostscript:
  1. Create a file in /etc/env.d called "99gs".
  2. Into the file put:
        GS_FONTPATH="/usr/share/fonts/cheapskate:/usr/share/fonts/..."
    including each directory of fonts that you want Ghostscript to use. Could be either Type1 or TrueType.
  3. Run env-update.

xfs

Red Hat LogoRedHat configures the distribution to run the X Font Server, xfs, as a separate process.

Red Hat LogoInstalling Windows TrueType fonts:

  1. Put the fonts into an existing font directory (run chkfontpath to find out what it is), or create a new directory.
  2. Add new directories in "/usr/X11R6/lib/X11/fs/config".
  3. Restart XFS: "/etc/init.d/xfs restart".
  4. It's a good idea to restart your X session after restarting XFS.

Red Hat LogoAdding fonts to Ghostscript:

  1. I renamed "/usr/share/ghostscript/7.05/lib/Fontmap" to "Fontmap.GS" to isolate the fonts that came with Ghostscript.
  2. I created a new "Fontmap" file with the lines:
    %!
    % See Fontmap.GS for the syntax of real Fontmap files.
    (Fontmap.GS) .runlibfile
    (Fontmap.local) .runlibfile
    (Fontmap.share) .runlibfile
  3. "Fontmap.local" contains fonts from "/usr/local/share/fonts".
  4. "Fontmap.share" contains fonts from "/usr/share/fonts".
  5. Add more fontmap files as needed. You need the font's PFB file, which TrueType does not have. See the Font HOWTO.

Adding fonts to OpenOffice

Gamma adjustment

Copyright © 2003-2004 Craig Lawson
Index no-thank-you-spam-i-am@i-hate-spam.spam.spam Document made with Nvu