1447 lines
27 KiB
HTML
1447 lines
27 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||
<HTML
|
||
><HEAD
|
||
><TITLE
|
||
>More X Configuration</TITLE
|
||
><META
|
||
NAME="GENERATOR"
|
||
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
|
||
REL="HOME"
|
||
TITLE="The X Window User HOWTO"
|
||
HREF="index.html"><LINK
|
||
REL="PREVIOUS"
|
||
TITLE="Running X"
|
||
HREF="runningx.html"><LINK
|
||
REL="NEXT"
|
||
TITLE="Fonts and Colors"
|
||
HREF="fontscolors.html"></HEAD
|
||
><BODY
|
||
CLASS="sect1"
|
||
BGCOLOR="#FFFFFF"
|
||
TEXT="#000000"
|
||
LINK="#0000FF"
|
||
VLINK="#840084"
|
||
ALINK="#0000FF"
|
||
><DIV
|
||
CLASS="NAVHEADER"
|
||
><TABLE
|
||
SUMMARY="Header navigation table"
|
||
WIDTH="100%"
|
||
BORDER="0"
|
||
CELLPADDING="0"
|
||
CELLSPACING="0"
|
||
><TR
|
||
><TH
|
||
COLSPAN="3"
|
||
ALIGN="center"
|
||
>The X Window User HOWTO</TH
|
||
></TR
|
||
><TR
|
||
><TD
|
||
WIDTH="10%"
|
||
ALIGN="left"
|
||
VALIGN="bottom"
|
||
><A
|
||
HREF="runningx.html"
|
||
ACCESSKEY="P"
|
||
>Prev</A
|
||
></TD
|
||
><TD
|
||
WIDTH="80%"
|
||
ALIGN="center"
|
||
VALIGN="bottom"
|
||
></TD
|
||
><TD
|
||
WIDTH="10%"
|
||
ALIGN="right"
|
||
VALIGN="bottom"
|
||
><A
|
||
HREF="fontscolors.html"
|
||
ACCESSKEY="N"
|
||
>Next</A
|
||
></TD
|
||
></TR
|
||
></TABLE
|
||
><HR
|
||
ALIGN="LEFT"
|
||
WIDTH="100%"></DIV
|
||
><DIV
|
||
CLASS="sect1"
|
||
><H1
|
||
CLASS="sect1"
|
||
><A
|
||
NAME="moreconfig"
|
||
></A
|
||
>4. More X Configuration</H1
|
||
><P
|
||
> Before taking a look at various configuration mechanisms for X servers and
|
||
clients, it should be noted that the advent of Desktop Environments like
|
||
<SPAN
|
||
CLASS="application"
|
||
>KDE</SPAN
|
||
> have become popular in part because they can
|
||
control much of the user interaction configuration themselves with nice,
|
||
<SPAN
|
||
CLASS="QUOTE"
|
||
>"user friendly"</SPAN
|
||
> GUI controls. And in fact,
|
||
the compliant applications that are part of the respective Desktops will be
|
||
best configured through the Desktop's configuration tools, or the
|
||
application's own GUI configuration methods. So, for instance,
|
||
<B
|
||
CLASS="command"
|
||
>gtop</B
|
||
>, a <SPAN
|
||
CLASS="application"
|
||
>GNOME</SPAN
|
||
> client
|
||
application, is best configured via <SPAN
|
||
CLASS="application"
|
||
>GNOME</SPAN
|
||
> or
|
||
<B
|
||
CLASS="command"
|
||
>gtop's</B
|
||
> own menus. But this is not true of all
|
||
<SPAN
|
||
CLASS="application"
|
||
>X</SPAN
|
||
> applications.
|
||
|
||
</P
|
||
><DIV
|
||
CLASS="sect2"
|
||
><H2
|
||
CLASS="sect2"
|
||
><A
|
||
NAME="xresources"
|
||
></A
|
||
>4.1. X Resources</H2
|
||
><P
|
||
> The X server can store various configuration values for client programs
|
||
so they are readily available when needed. If the application supports this,
|
||
it will use these as defaults whenever that program is invoked. These are
|
||
known as <SPAN
|
||
CLASS="QUOTE"
|
||
>"Resources"</SPAN
|
||
>, and are often used to define user preferences
|
||
on a per application basis for fonts, colors, screen placement (geometry) and
|
||
various other attributes. This makes it easy to customize applications.
|
||
|
||
</P
|
||
><P
|
||
> Resources are specified as text strings (e.g. Netscape*blinkingEnabled:
|
||
False) that can be read from disk in various places when
|
||
<SPAN
|
||
CLASS="application"
|
||
>X</SPAN
|
||
> is starting, or even interactively defined on the
|
||
command line. Program components are named in a hierarchical fashion, with
|
||
each object in the hierarchy identified by a class as well as an instance
|
||
name. At the top level of the hierarchy is the class and instance name of the
|
||
application itself. Typically, the class name of the application is the
|
||
same as the program name, but with the first letter capitalized (e.g. Vim or
|
||
Emacs) although some programs that begin with the letter <SPAN
|
||
CLASS="QUOTE"
|
||
>"X"</SPAN
|
||
>
|
||
also capitalize the second letter for historical reasons (e.g. XTerm).
|
||
Each definition will specify a class (or instance), with corresponding
|
||
resource and value. Below this in the hierarchy are the various attributes
|
||
that make up the definable aspects of the application.
|
||
|
||
</P
|
||
><P
|
||
> Traditionally, most <SPAN
|
||
CLASS="application"
|
||
>X</SPAN
|
||
> programs were configured
|
||
this way. This is not as true today with the advent of Desktop Environments
|
||
which often have their own configuration mechanisms.
|
||
|
||
</P
|
||
><P
|
||
> As an example, say we prefer to run <B
|
||
CLASS="command"
|
||
>xterm</B
|
||
> with a blue
|
||
background. So if we run it from the command line, we would run it as:
|
||
|
||
</P
|
||
><P
|
||
> <TABLE
|
||
BORDER="0"
|
||
BGCOLOR="#E0E0E0"
|
||
WIDTH="100%"
|
||
><TR
|
||
><TD
|
||
><FONT
|
||
COLOR="#000000"
|
||
><PRE
|
||
CLASS="screen"
|
||
>
|
||
xterm -bg blue &
|
||
|
||
</PRE
|
||
></FONT
|
||
></TD
|
||
></TR
|
||
></TABLE
|
||
>
|
||
</P
|
||
><P
|
||
> If this is our preference, it would be easier to put this preference in a
|
||
file somewhere, and have the system use our preference. That way whenever we
|
||
started <B
|
||
CLASS="command"
|
||
>xterm</B
|
||
>, it would use our preferred value, and we
|
||
wouldn't need the command line options (unless as an override).
|
||
|
||
</P
|
||
><P
|
||
> The basic <SPAN
|
||
CLASS="application"
|
||
>X</SPAN
|
||
> resource syntax is expressed like:
|
||
|
||
</P
|
||
><P
|
||
> <TABLE
|
||
BORDER="0"
|
||
BGCOLOR="#E0E0E0"
|
||
WIDTH="100%"
|
||
><TR
|
||
><TD
|
||
><FONT
|
||
COLOR="#000000"
|
||
><PRE
|
||
CLASS="screen"
|
||
>
|
||
<program><binding><widget><binding><widget><...><resource>:<value>
|
||
|
||
</PRE
|
||
></FONT
|
||
></TD
|
||
></TR
|
||
></TABLE
|
||
>
|
||
</P
|
||
><P
|
||
> Which, in real life, typically looks something like:
|
||
|
||
</P
|
||
><P
|
||
> <TABLE
|
||
BORDER="0"
|
||
BGCOLOR="#E0E0E0"
|
||
WIDTH="100%"
|
||
><TR
|
||
><TD
|
||
><FONT
|
||
COLOR="#000000"
|
||
><PRE
|
||
CLASS="screen"
|
||
>
|
||
xterm*fontMenu*background: darkblue
|
||
|
||
</PRE
|
||
></FONT
|
||
></TD
|
||
></TR
|
||
></TABLE
|
||
>
|
||
</P
|
||
><P
|
||
> It should be obvious what this does. The use of <SPAN
|
||
CLASS="QUOTE"
|
||
>"*"</SPAN
|
||
> in the
|
||
definition, is called a <SPAN
|
||
CLASS="QUOTE"
|
||
>"loose binding"</SPAN
|
||
> and acts as a
|
||
wild-card. Meaning there may be gaps in the widget hierarchy. For instance:
|
||
|
||
</P
|
||
><P
|
||
> <TABLE
|
||
BORDER="0"
|
||
BGCOLOR="#E0E0E0"
|
||
WIDTH="100%"
|
||
><TR
|
||
><TD
|
||
><FONT
|
||
COLOR="#000000"
|
||
><PRE
|
||
CLASS="screen"
|
||
>
|
||
xterm*background: darkblue
|
||
|
||
</PRE
|
||
></FONT
|
||
></TD
|
||
></TR
|
||
></TABLE
|
||
>
|
||
</P
|
||
><P
|
||
> This would also give a dark blue background for the <B
|
||
CLASS="command"
|
||
>xterm</B
|
||
>
|
||
fontMenu, but also any other <B
|
||
CLASS="command"
|
||
>xterm</B
|
||
> properties that also have a
|
||
<SPAN
|
||
CLASS="QUOTE"
|
||
>"background"</SPAN
|
||
> attribute (e.g. window background, etc), no matter
|
||
where they may be in the widget hierarchy. Similarly:
|
||
|
||
</P
|
||
><P
|
||
> <TABLE
|
||
BORDER="0"
|
||
BGCOLOR="#E0E0E0"
|
||
WIDTH="100%"
|
||
><TR
|
||
><TD
|
||
><FONT
|
||
COLOR="#000000"
|
||
><PRE
|
||
CLASS="screen"
|
||
>
|
||
*background: darkblue
|
||
|
||
</PRE
|
||
></FONT
|
||
></TD
|
||
></TR
|
||
></TABLE
|
||
>
|
||
</P
|
||
><P
|
||
> This would define the background for any and all programs that support it -- not just
|
||
<B
|
||
CLASS="command"
|
||
>xterm</B
|
||
>. Using a <SPAN
|
||
CLASS="QUOTE"
|
||
>"."</SPAN
|
||
> in place of a
|
||
<SPAN
|
||
CLASS="QUOTE"
|
||
>"*"</SPAN
|
||
> would be more precise, and will not allow for wild-card gaps
|
||
in the hierarchy. Also, the application must support the particular widget
|
||
attribute. <SPAN
|
||
CLASS="QUOTE"
|
||
>"Background"</SPAN
|
||
> is a fairly safe bet, but many
|
||
applications will have more specialized resources that are not so obvious. It
|
||
is best to check local documentation (man pages, etc), or see if an
|
||
application has an included examples. For instance, <B
|
||
CLASS="command"
|
||
>Netscape</B
|
||
>
|
||
generally comes with an <TT
|
||
CLASS="filename"
|
||
>Netscape.ad</TT
|
||
> file that has an extensive
|
||
set of resource definitions that can be customized.
|
||
|
||
</P
|
||
><P
|
||
> <SPAN
|
||
CLASS="application"
|
||
>X</SPAN
|
||
> resources are typically stored in more than one
|
||
place (see below) and are processed by the <B
|
||
CLASS="command"
|
||
>xrdb</B
|
||
> command (see man page).
|
||
|
||
</P
|
||
><DIV
|
||
CLASS="sect3"
|
||
><H3
|
||
CLASS="sect3"
|
||
><A
|
||
NAME="AEN674"
|
||
></A
|
||
>4.1.1. App Defaults</H3
|
||
><P
|
||
> One way of storing preferred application resources is via files named for the
|
||
application in an <SPAN
|
||
CLASS="QUOTE"
|
||
>"app-defaults"</SPAN
|
||
> directory. For instance, on my
|
||
system, these are in <TT
|
||
CLASS="filename"
|
||
>/usr/X11R6/lib/X11/app-defaults/</TT
|
||
>,
|
||
though this may vary according to options your vendor has chosen. This
|
||
directory contains a number of files for such well known
|
||
<SPAN
|
||
CLASS="application"
|
||
>X</SPAN
|
||
> applications as <B
|
||
CLASS="command"
|
||
>xterm</B
|
||
>,
|
||
<B
|
||
CLASS="command"
|
||
>xclock</B
|
||
>, <B
|
||
CLASS="command"
|
||
>xcalc</B
|
||
>,
|
||
<B
|
||
CLASS="command"
|
||
>xload</B
|
||
>, and so on. All in all, it is a relatively small
|
||
number of applications in the overall scheme of things. So not all
|
||
applications use this scheme. In fact, most do not.
|
||
|
||
</P
|
||
><P
|
||
> Each file will contain resource definitions for that application. The X
|
||
server loads these by itself during start up. A brief example from
|
||
<TT
|
||
CLASS="filename"
|
||
>XTerm-color</TT
|
||
>:
|
||
|
||
</P
|
||
><P
|
||
> <TABLE
|
||
BORDER="0"
|
||
BGCOLOR="#E0E0E0"
|
||
WIDTH="100%"
|
||
><TR
|
||
><TD
|
||
><FONT
|
||
COLOR="#000000"
|
||
><PRE
|
||
CLASS="screen"
|
||
>
|
||
! $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
|
||
|
||
</PRE
|
||
></FONT
|
||
></TD
|
||
></TR
|
||
></TABLE
|
||
>
|
||
</P
|
||
><P
|
||
> This is mostly various color definitions. The application classname is not
|
||
explicitly stated, and is assumed from the filename. So think of each line as
|
||
starting: <TT
|
||
CLASS="literal"
|
||
>XTerm-color*</TT
|
||
>. Also, notice at the top, the
|
||
<TT
|
||
CLASS="literal"
|
||
>#include "XTerm"</TT
|
||
> line, which <SPAN
|
||
CLASS="QUOTE"
|
||
>"includes"</SPAN
|
||
> the
|
||
resource definitions for <B
|
||
CLASS="command"
|
||
>XTerm</B
|
||
>, a much longer file with a
|
||
more diverse set of definitions. (Not included due to length, but worth
|
||
looking at.) These files provide system wide defaults, and generally
|
||
speaking, would not normally be edited by the user.
|
||
|
||
</P
|
||
></DIV
|
||
><DIV
|
||
CLASS="sect3"
|
||
><H3
|
||
CLASS="sect3"
|
||
><A
|
||
NAME="AEN693"
|
||
></A
|
||
>4.1.2. Xdefaults</H3
|
||
><P
|
||
> Another common method of reading in resource preferences, is with an
|
||
<TT
|
||
CLASS="filename"
|
||
>Xdefaults</TT
|
||
> file. Or, sometimes the naming
|
||
scheme may be <TT
|
||
CLASS="filename"
|
||
>Xresources</TT
|
||
> instead. This may exist as a
|
||
system wide file, such as <TT
|
||
CLASS="filename"
|
||
>/etc/X11/Xresources</TT
|
||
>.
|
||
Of course, the user is free to create a personal version in his home
|
||
directory, e.g. <TT
|
||
CLASS="filename"
|
||
>~/.Xdefaults</TT
|
||
>. The user's version will
|
||
over-ride any system wide settings, and will remain after system upgrades.
|
||
Obviously, this is the place to put your own preferences.
|
||
|
||
</P
|
||
><P
|
||
> <TT
|
||
CLASS="filename"
|
||
>Xresources</TT
|
||
> files are read into the resource database
|
||
with the <B
|
||
CLASS="command"
|
||
>xrdb</B
|
||
> command. Example:
|
||
|
||
</P
|
||
><P
|
||
> <TABLE
|
||
BORDER="0"
|
||
BGCOLOR="#E0E0E0"
|
||
WIDTH="100%"
|
||
><TR
|
||
><TD
|
||
><FONT
|
||
COLOR="#000000"
|
||
><PRE
|
||
CLASS="screen"
|
||
>
|
||
xrdb -merge ~/.Xresources
|
||
|
||
</PRE
|
||
></FONT
|
||
></TD
|
||
></TR
|
||
></TABLE
|
||
>
|
||
</P
|
||
><P
|
||
> This can be done interactively at the command line, or placed in a script and
|
||
run automatically as the <SPAN
|
||
CLASS="application"
|
||
>X</SPAN
|
||
> session is started. In
|
||
the case of system wide files, this should be taken care of by the vendor
|
||
supplied start up scripts. Generally, such scripts will also check the user's
|
||
home directory as well (see the <TT
|
||
CLASS="filename"
|
||
>xinitrc</TT
|
||
> example above).
|
||
So probably all that need be done, is to create the file with a text editor.
|
||
|
||
</P
|
||
><P
|
||
> Here's an example to illustrate a very few of the many things that might
|
||
be done with an <TT
|
||
CLASS="filename"
|
||
>.Xdefaults</TT
|
||
> file:
|
||
|
||
</P
|
||
><P
|
||
> <TABLE
|
||
BORDER="0"
|
||
BGCOLOR="#E0E0E0"
|
||
WIDTH="100%"
|
||
><TR
|
||
><TD
|
||
><FONT
|
||
COLOR="#000000"
|
||
><PRE
|
||
CLASS="screen"
|
||
>
|
||
! 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
|
||
|
||
</PRE
|
||
></FONT
|
||
></TD
|
||
></TR
|
||
></TABLE
|
||
>
|
||
</P
|
||
><P
|
||
> Hopefully, these few examples will give you some ideas to build on.
|
||
<SPAN
|
||
CLASS="application"
|
||
>X</SPAN
|
||
> does not need to be restarted if
|
||
<B
|
||
CLASS="command"
|
||
>xrdb</B
|
||
> is used interactively from the command line after
|
||
making changes. The effects are immediate.
|
||
|
||
</P
|
||
><P
|
||
> Resources are sometimes available also as command line options. See below.
|
||
Command line options will over-ride any existing resource definitions.
|
||
|
||
</P
|
||
></DIV
|
||
></DIV
|
||
><DIV
|
||
CLASS="sect2"
|
||
><H2
|
||
CLASS="sect2"
|
||
><A
|
||
NAME="AEN716"
|
||
></A
|
||
>4.2. xmodmap, the Keyboard and Mice</H2
|
||
><P
|
||
> The keyboard and mouse, as well as other possible input devices, are defined
|
||
in <TT
|
||
CLASS="filename"
|
||
>XF86Config</TT
|
||
> (or <TT
|
||
CLASS="filename"
|
||
>XF86Config-4</TT
|
||
>).
|
||
There is a keyboard layout that is defined based on the preferred language:
|
||
|
||
</P
|
||
><P
|
||
> <TABLE
|
||
BORDER="0"
|
||
BGCOLOR="#E0E0E0"
|
||
WIDTH="100%"
|
||
><TR
|
||
><TD
|
||
><FONT
|
||
COLOR="#000000"
|
||
><PRE
|
||
CLASS="screen"
|
||
>
|
||
Section "InputDevice"
|
||
Identifier "Keyboard0"
|
||
Driver "keyboard"
|
||
Option "XkbLayout" "us"
|
||
EndSection
|
||
|
||
</PRE
|
||
></FONT
|
||
></TD
|
||
></TR
|
||
></TABLE
|
||
>
|
||
</P
|
||
><P
|
||
> This gives us our default keyboard layout. Valid layout labels are listed in
|
||
<TT
|
||
CLASS="filename"
|
||
>/usr/X11R6/lib/X11/xkb/symbols</TT
|
||
>. Also, the
|
||
<B
|
||
CLASS="command"
|
||
>setxkbmap</B
|
||
> utility can be used to change this
|
||
interactively.
|
||
|
||
</P
|
||
><P
|
||
> <SPAN
|
||
CLASS="application"
|
||
>X</SPAN
|
||
> is highly customizable, and we can modify the
|
||
keyboard and mouse pointer mappings to suit our own preferences. The utility
|
||
to do this is <B
|
||
CLASS="command"
|
||
>xmodmap</B
|
||
> (see man page). You don't like where
|
||
the capslock key is? So move it ;-)
|
||
|
||
</P
|
||
><P
|
||
> Like <B
|
||
CLASS="command"
|
||
>xrdb</B
|
||
>, <B
|
||
CLASS="command"
|
||
>xmodmap</B
|
||
> can be run from the
|
||
command line. Or, preferred settings can be stored in a file. Typically this
|
||
is <TT
|
||
CLASS="filename"
|
||
>~/.Xmodmap</TT
|
||
>, or similar. If your
|
||
<SPAN
|
||
CLASS="application"
|
||
>X</SPAN
|
||
> start up files don't parse this, then edit as
|
||
appropriate so that they do (probably from <TT
|
||
CLASS="filename"
|
||
>~/.xinitrc</TT
|
||
> or
|
||
<TT
|
||
CLASS="filename"
|
||
>~/.xsession</TT
|
||
>).
|
||
|
||
</P
|
||
><P
|
||
> You can view your current key and mouse mappings with: <B
|
||
CLASS="command"
|
||
>xmodmap -pk
|
||
-pp |less</B
|
||
>. This will print out all active <SPAN
|
||
CLASS="QUOTE"
|
||
>"keycode"</SPAN
|
||
>
|
||
values, with corresponding <SPAN
|
||
CLASS="QUOTE"
|
||
>"keysym"</SPAN
|
||
> values, and any keysym names
|
||
that <B
|
||
CLASS="command"
|
||
>xmodmap</B
|
||
> knows about (e.g. <SPAN
|
||
CLASS="QUOTE"
|
||
>"BackSpace"</SPAN
|
||
>).
|
||
And should also give you an idea of how <B
|
||
CLASS="command"
|
||
>xmodmap</B
|
||
>
|
||
understands key and mouse events. There are two keysyms per keycode. The
|
||
second is the shifted value. XFree86's <B
|
||
CLASS="command"
|
||
>xev</B
|
||
> utility can be
|
||
used to dump a lot of information on key-presses and mouse events
|
||
interactively. Pay attention to the <SPAN
|
||
CLASS="QUOTE"
|
||
>"keycode"</SPAN
|
||
> value. That is
|
||
what you will need to know in order to re-map.
|
||
|
||
</P
|
||
><P
|
||
> <B
|
||
CLASS="command"
|
||
>xmodmap</B
|
||
> is often used to make minor keyboard adjustments,
|
||
like proper Backspace/Delete mapping. Or can be used make major adjustments
|
||
such as for international mappings. You can only re-map keys and mouse events
|
||
-- you cannot assign macros to key events (your Window Manager or Desktop
|
||
might have some of this functionality).
|
||
|
||
</P
|
||
><P
|
||
> A nice discussion of
|
||
<A
|
||
HREF="http://tldp.org/HOWTO/Intkeyb/index.html"
|
||
TARGET="_top"
|
||
>setting up international keyboards
|
||
</A
|
||
>.
|
||
|
||
Also,
|
||
<A
|
||
HREF="http://google.com/linux"
|
||
TARGET="_top"
|
||
>Google search</A
|
||
>
|
||
will turn up many creative examples.
|
||
|
||
</P
|
||
><P
|
||
> The man page has many brief examples of various usages. Here is what an
|
||
one hypothetical <TT
|
||
CLASS="filename"
|
||
>~/.Xmodmap</TT
|
||
> might look like:
|
||
|
||
</P
|
||
><P
|
||
> <TABLE
|
||
BORDER="0"
|
||
BGCOLOR="#E0E0E0"
|
||
WIDTH="100%"
|
||
><TR
|
||
><TD
|
||
><FONT
|
||
COLOR="#000000"
|
||
><PRE
|
||
CLASS="screen"
|
||
>
|
||
! /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
|
||
|
||
</PRE
|
||
></FONT
|
||
></TD
|
||
></TR
|
||
></TABLE
|
||
>
|
||
</P
|
||
><P
|
||
> As with many XFree86 files, the <SPAN
|
||
CLASS="QUOTE"
|
||
>"!"</SPAN
|
||
> represents a comment.
|
||
Another possible use, is to redefine those annoying <SPAN
|
||
CLASS="QUOTE"
|
||
>"Windows"</SPAN
|
||
>
|
||
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.
|
||
|
||
</P
|
||
><P
|
||
> Speaking of the <TT
|
||
CLASS="literal"
|
||
>Numlock</TT
|
||
> key, <SPAN
|
||
CLASS="application"
|
||
>X</SPAN
|
||
>
|
||
will typically disable this when it starts up. No matter how you have the
|
||
BIOS set up, or Linux set up before <SPAN
|
||
CLASS="application"
|
||
>X</SPAN
|
||
> starts. So the
|
||
trick above is one way. There is also a utility available as either
|
||
<SPAN
|
||
CLASS="application"
|
||
>numlockx</SPAN
|
||
>, or
|
||
<SPAN
|
||
CLASS="application"
|
||
>setnumlock</SPAN
|
||
>, 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 <TT
|
||
CLASS="literal"
|
||
>Numlock</TT
|
||
> on automatically if you would
|
||
prefer.
|
||
|
||
</P
|
||
><P
|
||
> Window Managers and Desktop Environments will also allow customization of the
|
||
keyboard and mouse (as long as it is recognized correctly by
|
||
<SPAN
|
||
CLASS="application"
|
||
>X</SPAN
|
||
>). This may be an easier way to configure certain
|
||
customizations.
|
||
|
||
</P
|
||
><DIV
|
||
CLASS="sect3"
|
||
><H3
|
||
CLASS="sect3"
|
||
><A
|
||
NAME="AEN766"
|
||
></A
|
||
>4.2.1. Special Key Mappings</H3
|
||
><P
|
||
> There are several special key mappings traditionally used in
|
||
XFree86.
|
||
|
||
</P
|
||
><P
|
||
></P
|
||
><DIV
|
||
CLASS="variablelist"
|
||
><DL
|
||
><DT
|
||
><B
|
||
CLASS="keycap"
|
||
>Ctrl</B
|
||
>-<B
|
||
CLASS="keycap"
|
||
>Alt</B
|
||
>-<B
|
||
CLASS="keycap"
|
||
>BackSpace</B
|
||
></DT
|
||
><DD
|
||
><P
|
||
> Will kill the <SPAN
|
||
CLASS="application"
|
||
>X</SPAN
|
||
> server process in an orderly
|
||
fashion. This is a quick, easy, legitimate way to restart
|
||
<SPAN
|
||
CLASS="application"
|
||
>X</SPAN
|
||
>. Note it does not restart the display
|
||
manager (if used) — just <SPAN
|
||
CLASS="application"
|
||
>X</SPAN
|
||
> itself.
|
||
</P
|
||
></DD
|
||
><DT
|
||
><B
|
||
CLASS="keycap"
|
||
>Ctrl</B
|
||
>-<B
|
||
CLASS="keycap"
|
||
>Alt</B
|
||
>-<B
|
||
CLASS="keycap"
|
||
>F<TT
|
||
CLASS="replaceable"
|
||
><I
|
||
>n</I
|
||
></TT
|
||
></B
|
||
></DT
|
||
><DD
|
||
><P
|
||
>
|
||
where <TT
|
||
CLASS="replaceable"
|
||
><I
|
||
>n</I
|
||
></TT
|
||
>
|
||
corresponds to a valid <SPAN
|
||
CLASS="acronym"
|
||
>TTY</SPAN
|
||
> number
|
||
(typically 1–6).
|
||
This is typically used to jump to a text console login,
|
||
while <SPAN
|
||
CLASS="application"
|
||
>X</SPAN
|
||
> remains running. To get back to
|
||
<SPAN
|
||
CLASS="application"
|
||
>X</SPAN
|
||
>,
|
||
press
|
||
<B
|
||
CLASS="keycap"
|
||
>Alt</B
|
||
>-<B
|
||
CLASS="keycap"
|
||
>F<TT
|
||
CLASS="replaceable"
|
||
><I
|
||
>n</I
|
||
></TT
|
||
></B
|
||
>. In this
|
||
case, <TT
|
||
CLASS="replaceable"
|
||
><I
|
||
>n</I
|
||
></TT
|
||
>
|
||
represents one plus the last <SPAN
|
||
CLASS="acronym"
|
||
>TTY</SPAN
|
||
>
|
||
(e.g. <B
|
||
CLASS="keycap"
|
||
>Alt</B
|
||
>-<B
|
||
CLASS="keycap"
|
||
>F7</B
|
||
> if
|
||
there are six available <SPAN
|
||
CLASS="acronym"
|
||
>TTY</SPAN
|
||
>’s).
|
||
</P
|
||
></DD
|
||
><DT
|
||
><B
|
||
CLASS="keycap"
|
||
>Ctrl</B
|
||
>-<B
|
||
CLASS="keycap"
|
||
>Alt</B
|
||
>-<B
|
||
CLASS="keycap"
|
||
>+</B
|
||
>
|
||
and <B
|
||
CLASS="keycap"
|
||
>Ctrl</B
|
||
>-<B
|
||
CLASS="keycap"
|
||
>Alt</B
|
||
>-<B
|
||
CLASS="keycap"
|
||
>-</B
|
||
></DT
|
||
><DD
|
||
><P
|
||
> That is the plus and minus keys on
|
||
the keypad. This will cycle through any existing valid screen resolution
|
||
modes, e.g. 1024<32>768 → 600<30>800. Note the actual screen
|
||
size is the same — just the view and resolution changes.
|
||
Not all that
|
||
useful for most purposes. You cannot permanently change the screen
|
||
resolution without restarting <SPAN
|
||
CLASS="application"
|
||
>X</SPAN
|
||
>.
|
||
|
||
</P
|
||
></DD
|
||
></DL
|
||
></DIV
|
||
><P
|
||
> It's possible your Window Manager, Desktop Environment or other system
|
||
component may trap these, and alter the standard behavior. In addition, the
|
||
<B
|
||
CLASS="keycap"
|
||
>Ctrl</B
|
||
>-<B
|
||
CLASS="keycap"
|
||
>Alt</B
|
||
>-<B
|
||
CLASS="keycap"
|
||
>Delete</B
|
||
> may be trapped as well. This should shut
|
||
<SPAN
|
||
CLASS="application"
|
||
>X</SPAN
|
||
> (and the system) down orderly, if it is
|
||
available.
|
||
|
||
</P
|
||
></DIV
|
||
><DIV
|
||
CLASS="sect3"
|
||
><H3
|
||
CLASS="sect3"
|
||
><A
|
||
NAME="AEN823"
|
||
></A
|
||
>4.2.2. Mice and Pointers</H3
|
||
><P
|
||
> As mentioned, Linux and Unix make heavy use of three mouse buttons. If a
|
||
mouse only has two buttons, then the third (i.e. the middle) button can
|
||
be simulated by pressing both buttons simultaneously. This is a
|
||
configuration option set in <TT
|
||
CLASS="filename"
|
||
>XF86Config</TT
|
||
> as the
|
||
<SPAN
|
||
CLASS="QUOTE"
|
||
>"Emulate3Buttons"</SPAN
|
||
> directive:
|
||
|
||
</P
|
||
><P
|
||
> <TABLE
|
||
BORDER="0"
|
||
BGCOLOR="#E0E0E0"
|
||
WIDTH="100%"
|
||
><TR
|
||
><TD
|
||
><FONT
|
||
COLOR="#000000"
|
||
><PRE
|
||
CLASS="screen"
|
||
>
|
||
Section "InputDevice"
|
||
Identifier "Mouse0"
|
||
Driver "mouse"
|
||
Option "Device" "/dev/mouse"
|
||
Option "Protocol" "PS/2"
|
||
Option "Emulate3Buttons" "on"
|
||
EndSection
|
||
|
||
</PRE
|
||
></FONT
|
||
></TD
|
||
></TR
|
||
></TABLE
|
||
>
|
||
</P
|
||
><P
|
||
> When all is said and done, a third button is quite handy and I would personally recommend
|
||
having one. On wheeled mice, the <SPAN
|
||
CLASS="QUOTE"
|
||
>"wheel"</SPAN
|
||
> acts as the third
|
||
button, if pressed. Many standard wheel mice seem to work with the
|
||
<SPAN
|
||
CLASS="QUOTE"
|
||
>"IMPS/2"</SPAN
|
||
> protocol option.
|
||
|
||
</P
|
||
><P
|
||
> Specifically, the third button (middle) is the <SPAN
|
||
CLASS="QUOTE"
|
||
>"paste"</SPAN
|
||
> button in
|
||
virtually all Linux applications. Copy and paste works a little different in
|
||
Linux. The left button is the copy button. Just hold it down, and drag over
|
||
text. It is automatically copied to the <SPAN
|
||
CLASS="application"
|
||
>X</SPAN
|
||
>
|
||
<SPAN
|
||
CLASS="QUOTE"
|
||
>"clipboard"</SPAN
|
||
>. Then, the middle button will paste from there. A
|
||
very simple process. A double-click should copy individual words, and a
|
||
triple-click individual lines of text. If for some reason, this does not
|
||
work, it is either a poorly implemented application, or a bug of some kind.
|
||
Some older versions of <SPAN
|
||
CLASS="application"
|
||
>Netscape</SPAN
|
||
> were not
|
||
consistent about this, for instance. To paste from the keyboard, this should
|
||
be shift+insert.
|
||
|
||
</P
|
||
><P
|
||
> <SPAN
|
||
CLASS="QUOTE"
|
||
>"Drag and Drop"</SPAN
|
||
> is not natively supported by
|
||
<SPAN
|
||
CLASS="application"
|
||
>X</SPAN
|
||
> itself. But, is implemented by some toolkits and
|
||
Desktop Environments. One should not expect this to work with non-compliant
|
||
applications (i.e non-<SPAN
|
||
CLASS="application"
|
||
>KDE</SPAN
|
||
> aware applications in
|
||
<SPAN
|
||
CLASS="application"
|
||
>KDE</SPAN
|
||
> for example).
|
||
|
||
</P
|
||
></DIV
|
||
></DIV
|
||
><DIV
|
||
CLASS="sect2"
|
||
><H2
|
||
CLASS="sect2"
|
||
><A
|
||
NAME="AEN843"
|
||
></A
|
||
>4.3. xset</H2
|
||
><P
|
||
> <B
|
||
CLASS="command"
|
||
>xset</B
|
||
> is yet another XFree86 utility to set user
|
||
preferences. <B
|
||
CLASS="command"
|
||
>xset</B
|
||
> is a bit of a catch-all and is used
|
||
to change various, unrelated X server settings. Mostly this is a command
|
||
line way of configuring some of the same things that are defined in
|
||
<TT
|
||
CLASS="filename"
|
||
>XF86Config</TT
|
||
> (but not everything!).
|
||
|
||
</P
|
||
><P
|
||
> Common usages of <B
|
||
CLASS="command"
|
||
>xset</B
|
||
> are to set DPMS on or off and
|
||
preferred intervals, to dynamically change the FontPath or re-read it, to
|
||
control keyboard LEDs, to adjust mouse (or other pointer) movement speed,
|
||
set keyboard <SPAN
|
||
CLASS="QUOTE"
|
||
>"autorepeat"</SPAN
|
||
> and <SPAN
|
||
CLASS="QUOTE"
|
||
>"repeat"</SPAN
|
||
> rates, and
|
||
to control <SPAN
|
||
CLASS="application"
|
||
>X's</SPAN
|
||
> built in screen blanking. See the
|
||
man page, of course, for detailed explanations, and other
|
||
<B
|
||
CLASS="command"
|
||
>xset</B
|
||
> usages.
|
||
|
||
</P
|
||
><P
|
||
> Again, <B
|
||
CLASS="command"
|
||
>xset</B
|
||
> can be used interactively from the command
|
||
line. But most often preferred settings are stored in one of the start up
|
||
configuration files, like <TT
|
||
CLASS="filename"
|
||
>.xinitrc</TT
|
||
> or
|
||
<TT
|
||
CLASS="filename"
|
||
>.xsession</TT
|
||
>. A very brief example:
|
||
|
||
</P
|
||
><P
|
||
> <TABLE
|
||
BORDER="0"
|
||
BGCOLOR="#E0E0E0"
|
||
WIDTH="100%"
|
||
><TR
|
||
><TD
|
||
><FONT
|
||
COLOR="#000000"
|
||
><PRE
|
||
CLASS="screen"
|
||
>
|
||
# 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
|
||
|
||
</PRE
|
||
></FONT
|
||
></TD
|
||
></TR
|
||
></TABLE
|
||
>
|
||
</P
|
||
><P
|
||
> Your desktop may have a GUI front-end for <B
|
||
CLASS="command"
|
||
>xset</B
|
||
>.
|
||
|
||
</P
|
||
></DIV
|
||
></DIV
|
||
><DIV
|
||
CLASS="NAVFOOTER"
|
||
><HR
|
||
ALIGN="LEFT"
|
||
WIDTH="100%"><TABLE
|
||
SUMMARY="Footer navigation table"
|
||
WIDTH="100%"
|
||
BORDER="0"
|
||
CELLPADDING="0"
|
||
CELLSPACING="0"
|
||
><TR
|
||
><TD
|
||
WIDTH="33%"
|
||
ALIGN="left"
|
||
VALIGN="top"
|
||
><A
|
||
HREF="runningx.html"
|
||
ACCESSKEY="P"
|
||
>Prev</A
|
||
></TD
|
||
><TD
|
||
WIDTH="34%"
|
||
ALIGN="center"
|
||
VALIGN="top"
|
||
><A
|
||
HREF="index.html"
|
||
ACCESSKEY="H"
|
||
>Home</A
|
||
></TD
|
||
><TD
|
||
WIDTH="33%"
|
||
ALIGN="right"
|
||
VALIGN="top"
|
||
><A
|
||
HREF="fontscolors.html"
|
||
ACCESSKEY="N"
|
||
>Next</A
|
||
></TD
|
||
></TR
|
||
><TR
|
||
><TD
|
||
WIDTH="33%"
|
||
ALIGN="left"
|
||
VALIGN="top"
|
||
>Running X</TD
|
||
><TD
|
||
WIDTH="34%"
|
||
ALIGN="center"
|
||
VALIGN="top"
|
||
> </TD
|
||
><TD
|
||
WIDTH="33%"
|
||
ALIGN="right"
|
||
VALIGN="top"
|
||
>Fonts and Colors</TD
|
||
></TR
|
||
></TABLE
|
||
></DIV
|
||
></BODY
|
||
></HTML
|
||
> |