1 @c This is part of the Emacs manual.
2 @c Copyright (C) 1987,93,94,95,1997,2001,03 Free Software Foundation, Inc.
3 @c See file emacs.texi for copying conditions.
4 @node X Resources, Antinews, Emacs Invocation, Top
5 @appendix X Options and Resources
7 You can customize some X-related aspects of Emacs behavior using X
8 resources, as is usual for programs that use X. On MS-Windows, you
9 can customize some of the same aspects using the system registry.
10 @xref{MS-Windows Registry}.
12 When Emacs is built using an `X toolkit', such as Lucid or LessTif,
13 you need to use X resources to customize the appearance of the
14 widgets, including the menu-bar, scroll-bar, and dialog boxes. This
15 is because the libraries that implement these don't provide for
16 customization through Emacs. GTK+ widgets use a separate system of
17 `GTK resources', which we will also describe.
20 * Resources:: Using X resources with Emacs (in general).
21 * Table of Resources:: Table of specific X resources that affect Emacs.
22 * Face Resources:: X resources for customizing faces.
23 * Lucid Resources:: X resources for Lucid menus.
24 * LessTif Resources:: X resources for LessTif and Motif menus.
25 * GTK resources:: Resources for GTK widgets.
29 @appendixsec X Resources
32 @cindex @file{~/.Xdefaults} file
33 @cindex @file{~/.Xresources} file
35 Programs running under the X Window System organize their user
36 options under a hierarchy of classes and resources. You can specify
37 default values for these options in your X resources file, usually
38 named @file{~/.Xdefaults} or @file{~/.Xresources}.
39 If changes in @file{~/.Xdefaults} do not
40 take effect, it is because your X server stores its own list of
41 resources; to update them, use the shell command @command{xrdb}---for
42 instance, @samp{xrdb ~/.Xdefaults}.
44 Each line in the file specifies a value for one option or for a
45 collection of related options, for one program or for several programs
46 (optionally even for all programs).
48 @cindex Registry (MS-Windows)
49 MS-Windows systems don't support @file{~/.Xdefaults} files, but
50 Emacs compiled for Windows looks for X resources in the Windows
51 Registry, under the key @samp{HKEY_CURRENT_USER\SOFTWARE\GNU\Emacs}
52 and then under the key @samp{HKEY_LOCAL_MACHINE\SOFTWARE\GNU\Emacs}.
53 The menu and scrollbars are native widgets on MS-Windows, so they are
54 only customizable via the system-wide settings in the Display Control
55 Panel. You can also set resources using the @samp{-xrm} command line
58 Programs define named resources with particular meanings. They also
59 define how to group resources into named classes. For instance, in
60 Emacs, the @samp{internalBorder} resource controls the width of the
61 internal border, and the @samp{borderWidth} resource controls the width
62 of the external border. Both of these resources are part of the
63 @samp{BorderWidth} class. Case distinctions are significant in these
66 Every resource definition is associated with a specific program
67 name---the name of the executable file that you ran. For Emacs, that
68 is normally @samp{emacs}. To specify a definition for all instances
69 of Emacs, regardless of their names, use @samp{Emacs}.
71 In @file{~/.Xdefaults}, you can specify a value for a single resource
72 on one line, like this:
79 Or you can use a class name to specify the same value for all resources
80 in that class. Here's an example:
86 If you specify a value for a class, it becomes the default for all
87 resources in that class. You can specify values for individual
88 resources as well; these override the class value, for those particular
89 resources. Thus, this example specifies 2 as the default width for all
90 borders, but overrides this value with 4 for the external border:
97 The order in which the lines appear in the file does not matter.
98 Also, command-line options always override the X resources file.
99 Here is a list of X command-line options and their corresponding
103 @item -name @var{name}
105 @itemx --name=@var{name}
106 @cindex resource name, command-line argument
107 Use @var{name} as the resource name (and the title) for the initial
108 Emacs frame. This option does not affect subsequent frames, but Lisp
109 programs can specify frame names when they create frames.
111 If you don't specify this option, the default is to use the Emacs
112 executable's name as the resource name.
114 @item -xrm @var{resource-values}
116 @itemx --xrm=@var{resource-values}
117 @cindex resource values, command-line argument
118 Specify X resource values for this Emacs job (see below).
121 For consistency, @samp{-name} also specifies the name to use for
122 other resource values that do not belong to any particular frame.
124 The resources that name Emacs invocations also belong to a class; its
125 name is @samp{Emacs}. If you write @samp{Emacs} instead of
126 @samp{emacs}, the resource applies to all frames in all Emacs jobs,
127 regardless of frame titles and regardless of the name of the executable
128 file. Here is an example:
135 You can specify a string of additional resource values for Emacs to
136 use with the command line option @samp{-xrm @var{resources}}. The text
137 @var{resources} should have the same format that you would use inside a file
138 of X resources. To include multiple resource specifications in
139 @var{resources}, put a newline between them, just as you would in a file.
140 You can also use @samp{#include "@var{filename}"} to include a file full
141 of resource specifications. Resource values specified with @samp{-xrm}
142 take precedence over all other resource specifications.
144 One way to experiment with the effect of different resource settings
145 is to use the @code{editres} program. Select @samp{Get Tree} from the
146 @samp{Commands} menu, then click on an Emacs frame. This will display
147 a tree showing the structure of X toolkit widgets used in an Emacs
148 frame. Select one of them, such as @samp{menubar}, then select
149 @samp{Show Resource Box} from the @samp{Commands} menu. This displays
150 a list of all the meaningful X resources and allows you to edit them.
151 Changes take effect immediately if you click on the @samp{Apply} button.
152 (See the @code{editres} man page for more details.)
154 @node Table of Resources
155 @appendixsec Table of X Resources for Emacs
157 This table lists the resource names that designate options for
158 Emacs, not counting those for the appearance of the menu bar, each
159 with the class that it belongs to:
162 @item @code{background} (class @code{Background})
163 Background color name.
165 @item @code{bitmapIcon} (class @code{BitmapIcon})
166 Use a bitmap icon (a picture of a gnu) if @samp{on}, let the window
167 manager choose an icon if @samp{off}.
169 @item @code{borderColor} (class @code{BorderColor})
170 Color name for the external border.
172 @item @code{borderWidth} (class @code{BorderWidth})
173 Width in pixels of the external border.
175 @item @code{cursorColor} (class @code{Foreground})
176 Color name for text cursor (point).
178 @item @code{cursorBlink} (class @code{CursorBlink})
179 Specifies whether to make the cursor blink. The default is @samp{on}. Use
180 @samp{off} or @samp{false} to turn cursor blinking off.
182 @item @code{font} (class @code{Font})
183 Font name for text (or fontset name, @pxref{Fontsets}).
185 @item @code{foreground} (class @code{Foreground})
188 @item @code{geometry} (class @code{Geometry})
189 Window size and position. Be careful not to specify this resource as
190 @samp{emacs*geometry}, because that may affect individual menus as well
191 as the Emacs frame itself.
193 If this resource specifies a position, that position applies only to the
194 initial Emacs frame (or, in the case of a resource for a specific frame
195 name, only that frame). However, the size, if specified here, applies to
198 @item @code{fullscreen} (class @code{Fullscreen})
199 The desired fullscreen size. The value can be one of @code{fullboth},
200 @code{fullwidth} or @code{fullheight}, which correspond to
201 the command-line options @samp{-fs}, @samp{-fw}, and @samp{-fh}
202 (@pxref{Window Size X}).
204 Note that this applies to all frames created, not just the initial
207 @item @code{iconName} (class @code{Title})
208 Name to display in the icon.
210 @item @code{internalBorder} (class @code{BorderWidth})
211 Width in pixels of the internal border.
213 @item @code{lineSpacing} (class @code{LineSpacing})
216 Additional space (@dfn{leading}) between lines, in pixels.
218 @item @code{menuBar} (class @code{MenuBar})
220 Give frames menu bars if @samp{on}; don't have menu bars if
221 @samp{off}. @xref{Lucid Resources}, and @ref{LessTif Resources}, for
222 how to control the appearance of the menu bar if you have one.
224 @item @code{minibuffer} (class @code{Minibuffer})
225 If @samp{none}, don't make a minibuffer in this frame.
226 It will use a separate minibuffer frame instead.
228 @item @code{paneFont} (class @code{Font})
229 @cindex font for menus
230 Font name for menu pane titles, in non-toolkit versions of Emacs.
232 @item @code{pointerColor} (class @code{Foreground})
233 Color of the mouse cursor.
235 @item @code{privateColormap} (class @code{PrivateColormap})
236 If @samp{on}, use a private color map, in the case where the ``default
237 visual'' of class PseudoColor and Emacs is using it.
239 @item @code{reverseVideo} (class @code{ReverseVideo})
240 Switch foreground and background default colors if @samp{on}, use colors as
241 specified if @samp{off}.
243 @item @code{screenGamma} (class @code{ScreenGamma})
244 @cindex gamma correction
245 Gamma correction for colors, equivalent to the frame parameter
248 @item @code{selectionFont} (class @code{SelectionFont})
249 Font name for pop-up menu items, in non-toolkit versions of Emacs. (For
250 toolkit versions, see @ref{Lucid Resources}, also see @ref{LessTif
253 @item @code{selectionTimeout} (class @code{SelectionTimeout})
254 Number of milliseconds to wait for a selection reply.
255 If the selection owner doesn't reply in this time, we give up.
256 A value of 0 means wait as long as necessary.
258 @item @code{synchronous} (class @code{Synchronous})
259 @cindex debugging X problems
260 @cindex synchronous X mode
261 Run Emacs in synchronous mode if @samp{on}. Synchronous mode is
262 useful for debugging X problems.
264 @item @code{title} (class @code{Title})
265 Name to display in the title bar of the initial Emacs frame.
267 @item @code{toolBar} (class @code{ToolBar})
269 Number of lines to reserve for the tool bar. A zero value suppresses
270 the tool bar. If the value is non-zero and
271 @code{auto-resize-tool-bars} is non-@code{nil}, the tool bar's size
272 will be changed automatically so that all tool bar items are visible.
274 @item @code{useXIM} (class @code{UseXIM})
276 @cindex X input methods
277 @cindex input methods, X
278 Turn off use of X input methods (XIM) if @samp{false} or @samp{off}.
279 This is only relevant if your Emacs is actually built with XIM
280 support. It is potentially useful to turn off XIM for efficiency,
281 especially slow X client/server links.
283 @item @code{verticalScrollBars} (class @code{ScrollBars})
284 Give frames scroll bars if @samp{on}; don't have scroll bars if
287 @item @code{visualClass} (class @code{VisualClass})
288 Specify the ``visual'' that X should use. This tells X how to handle
291 The value should start with one of @samp{TrueColor},
292 @samp{PseudoColor}, @samp{DirectColor}, @samp{StaticColor},
293 @samp{GrayScale}, and @samp{StaticGray}, followed by
294 @samp{-@var{depth}}, where @var{depth} is the number of color planes.
295 Most terminals only allow a few ``visuals,'' and the @samp{dpyinfo}
296 program outputs information saying which ones.
300 @appendixsec X Resources for Faces
302 You can also use resources to customize the appearance of particular
303 faces (@pxref{Faces}):
306 @item @var{face}.attributeFont
307 Font for face @var{face}.
308 @item @var{face}.attributeForeground
309 Foreground color for face @var{face}.
310 @item @var{face}.attributeBackground
311 Background color for face @var{face}.
312 @item @var{face}.attributeUnderline
313 Underline flag for face @var{face}. Use @samp{on} or @samp{true} for
315 @item @var{face}.attributeFamily
316 Font family for face @var{face}.
317 @item @var{face}.attributeWidth
318 Relative proportional width of the font to use for face @var{face}.
319 It should be one of @code{ultra-condensed}, @code{extra-condensed},
320 @code{condensed}, @code{semi-condensed}, @code{normal},
321 @code{semi-expanded}, @code{expanded}, @code{extra-expanded}, or
322 @code{ultra-expanded}.
323 @item @var{face}.attributeHeight
324 Height of the font to use for face @var{face}: either an integer
325 specifying the height in units of 1/10@dmn{pt}, or a floating point
326 number that specifies a scale factor to scale the underlying face's
327 default font, or a function to be called with the default height which
328 will return a new height.
329 @item @var{face}.attributeWeight
330 A weight to use for the face @var{face}. It must be one of
331 @code{ultra-bold}, @code{extra-bold}, @code{bold},
332 @code{semi-bold}, @code{normal}, @code{semi-light}, @code{light},
333 @code{extra-light}, @code{ultra-light}.
334 @item @var{face}.attributeSlant
335 The slant to use for the font of face @var{face}. It must be one of
336 @code{italic}, @code{oblique}, @code{normal},
337 @code{reverse-italic}, or @code{reverse-oblique}.
338 @item @var{face}.attributeStrikeThrough
339 Whether the face @var{face} should be drawn with a line striking
340 through the characters.
341 @item @var{face}.attributeOverline
342 Whether the characters in the face @var{face} should be overlined.
343 @item @var{face}.attributeBox
344 Whether to draw a box around the characters in face @var{face}.
345 @item @var{face}.attributeInverse
346 Whether to display the characters in face @var{face} in inverse
348 @item @var{face}.attributeStipple
349 The name of a pixmap data file to use for the stipple pattern, or
350 @code{false} to not use stipple for the face @var{face}.
351 @item @var{face}.attributeBackgroundPixmap
352 The background pixmap for the face @var{face}. Should be a name of a
353 pixmap file or @code{false}.
354 @item @var{face}.attributeBold
355 Whether to draw the characters in the face @var{face} as bold.
356 @item @var{face}.attributeItalic
357 Whether to draw the characters in the face @var{face} as italic.
360 @node Lucid Resources
361 @appendixsec Lucid Menu X Resources
362 @cindex Menu X Resources (Lucid widgets)
363 @cindex Lucid Widget X Resources
365 If the Emacs installed at your site was built to use the X toolkit
366 with the Lucid menu widgets, then the menu bar is a separate widget and
367 has its own resources. The resource names contain @samp{pane.menubar}
368 (following, as always, the name of the Emacs invocation, or @samp{Emacs},
369 which stands for all Emacs invocations). Specify them like this:
372 Emacs.pane.menubar.@var{resource}: @var{value}
376 For example, to specify the font @samp{8x16} for the menu-bar items,
380 Emacs.pane.menubar.font: 8x16
384 Resources for @emph{non-menubar} toolkit pop-up menus have
385 @samp{menu*}, in like fashion. For example, to specify the font
386 @samp{8x16} for the pop-up menu items, write this:
389 Emacs.menu*.font: 8x16
393 For dialog boxes, use @samp{dialog} instead of @samp{menu}:
396 Emacs.dialog*.font: 8x16
400 The Lucid menus can display multilingual text in your locale. For more
401 information about fontsets see the man page for XCreateFontSet. To enable
402 multilingual menu text you specify a fontSet resource instead of the font
403 resource. If both font and fontSet resources are specified, the fontSet
404 resource is used. To specify
405 @samp{-*-helvetica-medium-r-*--*-120-*-*-*-*-*-*,*} for both the popup and
406 menu bar menus, write this:
409 Emacs*fontSet: -*-helvetica-medium-r-*--*-120-*-*-*-*-*-*,*
413 Experience shows that on some systems you may need to add
414 @samp{shell.}@: before the @samp{pane.menubar} or @samp{menu*}. On
415 some other systems, you must not add @samp{shell.}.
417 Here is a list of the specific resources for menu bars and pop-up menus:
421 Font for menu item text.
423 Fontset for menu item text.
425 Color of the foreground.
427 Color of the background.
428 @item buttonForeground
429 In the menu bar, the color of the foreground for a selected item.
430 @item horizontalSpacing
431 Horizontal spacing in pixels between items. Default is 3.
432 @item verticalSpacing
433 Vertical spacing in pixels between items. Default is 2.
435 Horizontal spacing between the arrow (which indicates a submenu) and
436 the associated text. Default is 10.
437 @item shadowThickness
438 Thickness of shadow line around the widget. Default is 1.
440 Also determines the thickness of shadow lines around other objects,
441 for instance 3D buttons and arrows. If you have the impression that
442 the arrows in the menus do not stand out clearly enough or that the
443 difference between ``in'' and ``out'' buttons is difficult to see, set
444 this to 2. If you have no problems with visibility, the default
445 probably looks better. The background color may also have some effect
448 The margin of the menu bar, in characters. Default is 1.
451 @node LessTif Resources
452 @appendixsec LessTif Menu X Resources
453 @cindex Menu X Resources (LessTif widgets)
454 @cindex LessTif Widget X Resources
456 If the Emacs installed at your site was built to use the X toolkit
457 with the LessTif or Motif widgets, then the menu bar, the dialog
458 boxes, the pop-up menus, and the file-selection box are separate
459 widgets and have their own resources.
461 The resource names for the menu bar contain @samp{pane.menubar}
462 (following, as always, the name of the Emacs invocation, or
463 @samp{Emacs}, which stands for all Emacs invocations). Specify them
467 Emacs.pane.menubar.@var{subwidget}.@var{resource}: @var{value}
470 Each individual string in the menu bar is a subwidget; the subwidget's
471 name is the same as the menu item string. For example, the word
472 @samp{File} in the menu bar is part of a subwidget named
473 @samp{emacs.pane.menubar.File}. Most likely, you want to specify the
474 same resources for the whole menu bar. To do this, use @samp{*} instead
475 of a specific subwidget name. For example, to specify the font
476 @samp{8x16} for the menu-bar items, write this:
479 Emacs.pane.menubar.*.fontList: 8x16
483 This also specifies the resource value for submenus.
485 Each item in a submenu in the menu bar also has its own name for X
486 resources; for example, the @samp{File} submenu has an item named
487 @samp{Save (current buffer)}. A resource specification for a submenu
488 item looks like this:
491 Emacs.pane.menubar.popup_*.@var{menu}.@var{item}.@var{resource}: @var{value}
495 For example, here's how to specify the font for the @samp{Save (current
499 Emacs.pane.menubar.popup_*.File.Save (current buffer).fontList: 8x16
503 For an item in a second-level submenu, such as @samp{Complete Word}
504 under @samp{Spell Checking} under @samp{Tools}, the resource fits this
508 Emacs.pane.menubar.popup_*.popup_*.@var{menu}.@var{resource}: @var{value}
515 Emacs.pane.menubar.popup_*.popup_*.Spell Checking.Complete Word: @var{value}
519 (This should be one long line.)
521 It's impossible to specify a resource for all the menu-bar items
522 without also specifying it for the submenus as well. So if you want the
523 submenu items to look different from the menu bar itself, you must ask
524 for that in two steps. First, specify the resource for all of them;
525 then, override the value for submenus alone. Here is an example:
528 Emacs.pane.menubar.*.fontList: 8x16
529 Emacs.pane.menubar.popup_*.fontList: 8x16
533 For LessTif pop-up menus, use @samp{menu*} instead of
534 @samp{pane.menubar}. For example, to specify the font @samp{8x16} for
535 the pop-up menu items, write this:
538 Emacs.menu*.fontList: 8x16
542 For LessTif dialog boxes, use @samp{dialog} instead of @samp{menu}:
545 Emacs.dialog*.fontList: 8x16
546 Emacs.dialog*.foreground: hotpink
549 To specify resources for the LessTif file-selection box, use
550 @samp{fsb*}, like this:
553 Emacs.fsb*.fontList: 8x16
559 Here is a list of the specific resources for LessTif menu bars and
564 The color to show in an armed button.
573 Amount of space to leave around the item, within the border.
575 The width of the border around the menu item, on all sides.
576 @item shadowThickness
577 The width of the border shadow.
578 @item bottomShadowColor
579 The color for the border shadow, on the bottom and the right.
581 The color for the border shadow, on the top and the left.
586 @appendixsec GTK resources
587 @cindex GTK resources and customization
588 @cindex resource files for GTK
589 @cindex @file{~/.gtkrc-2.0} file
590 @cindex @file{~/.emacs.d/gtkrc} file
592 If Emacs was built to use the GTK widget set, then the menu bar,
593 scroll bar and the dialogs are customized with the standard GTK
594 customization file, @file{~/.gtkrc-2.0}, or with the Emacs specific
595 file @file{~/.emacs.d/gtkrc}. We recommend that you use
596 @file{~/.emacs.d/gtkrc} for customizations, since @file{~/.gtkrc-2.0}
597 seems to be ignored when running GConf with GNOME. These files apply
598 only to GTK widget features. To customize Emacs font, background,
599 faces, etc., use the normal X resources (@pxref{Resources}).
601 Some GTK themes override these mechanisms, which means that using
602 these mechanisms will not work to customize them.
604 In these files you first define a style and say what it means; then
605 you specify to apply the style to various widget types (@pxref{GTK
606 widget names}). Here is an example of how to change the font for
610 # @r{Define the style @samp{metafont}.}
613 font_name = "helvetica bold 14" # This is a Pango font name
616 # @r{Specify that widget type @samp{*emacs-menuitem*} uses @samp{metafont}.}
617 widget "*emacs-menuitem*" style "menufont"
620 Here is a more elaborate example, showing how to change the parts of
626 fg[NORMAL] = "red"@ @ @ @ @ # @r{The arrow color.}
627 bg[NORMAL] = "yellow"@ @ # @r{The thumb and background around the arrow.}
628 bg[ACTIVE] = "blue"@ @ @ @ # @r{The trough color.}
629 bg[PRELIGHT] = "white"@ # @r{The thumb color when the mouse is over it.}
632 widget "*verticalScrollBar*" style "scroll"
635 There are also parameters that affect GTK as a whole. For example,
636 the property @code{gtk-font-name} sets the default font for GTK. You
637 must use Pango font names (@pxref{GTK styles}). A GTK resources file
638 that just sets a default font looks like this:
641 gtk-font-name = "courier 12"
644 The GTK resources file is fully described in the GTK API document.
646 @file{@var{prefix}/share/gtk-doc/html/gtk/gtk-resource-files.html},
647 where @file{prefix} is the directory in which the GTK libraries were
648 installed (usually @file{/usr} or @file{/usr/local}). You can also
649 find the document online, at
650 @uref{http://developer.gnome.org/doc/API/2.0/gtk/gtk-Resource-Files.html}.
653 * GTK widget names:: How widgets in GTK are named in general.
654 * GTK Names in Emacs:: GTK widget names in Emacs.
655 * GTK styles:: What can be customized in a GTK widget.
658 @node GTK widget names
659 @appendixsubsec GTK widget names
660 @cindex GTK widget names
662 A GTK widget is specified by its @dfn{widget class} and
663 @dfn{widget name}. The widget class is the type of the widget: for
664 example, @code{GtkMenuBar}. The widget name is the name given to a
665 specific widget. A widget always has a class, but need not have a
668 @dfn{Absolute names} are sequences of widget names or widget
669 classes, corresponding to hierarchies of widgets embedded within
670 other widgets. For example, if a @code{GtkWindow} named @code{top}
671 contains a @code{GtkVBox} named @code{box}, which in turn contains
672 a @code{GtkMenuBar} called @code{menubar}, the absolute class name
673 of the menu-bar widget is @code{GtkWindow.GtkVBox.GtkMenuBar}, and
674 its absolute widget name is @code{top.box.menubar}.
676 When assigning a style to a widget, you can use the absolute class
677 name or the absolute widget name.
679 There are two commands to specify changes for widgets:
682 @item @code{widget_class}
683 specifies a style for widgets based on the absolute class name.
686 specifies a style for widgets based on the absolute class name,
691 You must specify the class and the style in double-quotes, and put
692 these commands at the top level in the GTK customization file, like
698 font_name = "helvetica bold 14"
701 widget "top.box.menubar" style "menufont"
702 widget_class "GtkWindow.GtkVBox.GtkMenuBar" style "menufont"
705 Matching of absolute names uses shell wildcard syntax: @samp{*}
706 matches zero or more characters and @samp{?} matches one character.
707 This example assigns @code{base_style} to all widgets:
710 widget "*" style "base_style"
713 Given the absolute class name @code{GtkWindow.GtkVBox.GtkMenuBar}
714 and the corresponding absolute widget name @code{top.box.menubar}, all
715 these examples specify @code{my_style} for the menu bar:
718 widget_class "GtkWindow.GtkVBox.GtkMenuBar" style "my_style"
719 widget_class "GtkWindow.*.GtkMenuBar" style "my_style"
720 widget_class "*GtkMenuBar" style "my_style"
721 widget "top.box.menubar" style "my_style"
722 widget "*box*menubar" style "my_style"
723 widget "*menubar" style "my_style"
724 widget "*menu*" style "my_style"
727 @node GTK Names in Emacs
728 @appendixsubsec GTK Widget Names in Emacs
729 @cindex GTK widget names
730 @cindex GTK widget classes
732 In Emacs, the top level widget for a frame is a @code{GtkWindow}
733 that contains a @code{GtkVBox}. The @code{GtkVBox} contains the
734 @code{GtkMenuBar} and a @code{GtkFixed} widget. The vertical scroll
735 bars, @code{GtkVScrollbar}, are contained in the @code{GtkFixed}
736 widget. The text you write in Emacs is drawn in the @code{GtkFixed}
739 Dialogs in Emacs are @code{GtkDialog} widgets. The file dialog is a
740 @code{GtkFileSelection} widget.
743 To set a style for the menu bar using the absolute class name, use:
746 widget_class "GtkWindow.GtkVBox.GtkMenuBar" style "my_style"
750 For the scroll bar, the absolute class name is:
754 "GtkWindow.GtkVBox.GtkFixed.GtkVScrollbar"
759 The names for the emacs widgets, and their classes, are:
761 @multitable {@code{verticalScrollbar plus}} {@code{GtkFileSelection} and some}
762 @item @code{emacs-filedialog}
763 @tab @code{GtkFileSelection}
764 @item @code{emacs-dialog}
765 @tab @code{GtkDialog}
767 @tab @code{GtkWindow}
772 @item @code{verticalScrollBar}
773 @tab @code{GtkVScrollbar}
774 @item @code{emacs-toolbar}
775 @tab @code{GtkToolbar}
777 @tab @code{GtkMenuBar}
778 @item @code{emacs-menuitem}
779 @tab anything in menus
783 Thus, for Emacs you can write the two examples above as:
786 widget "Emacs.pane.menubar" style "my_style"
787 widget "Emacs.pane.emacs.verticalScrollBar" style "my_style"
790 GTK absolute names are quite strange when it comes to menus
791 and dialogs. The names do not start with @samp{Emacs}, as they are
792 free-standing windows and not contained (in the GTK sense) by the
793 Emacs GtkWindow. To customize the dialogs and menus, use wildcards like this:
796 widget "*emacs-dialog*" style "my_dialog_style"
797 widget "*emacs-filedialog* style "my_file_style"
798 widget "*emacs-menuitem* style "my_menu_style"
801 If you specify a customization in @file{~/.emacs.d/gtkrc}, then it
802 automatically applies only to Emacs, since other programs don't read
803 that file. For example, the drop down menu in the file dialog can not
804 be customized by any absolute widget name, only by an absolute class
805 name. This is because the widgets in the drop down menu do not
806 have names and the menu is not contained in the Emacs GtkWindow. To
807 have all menus in Emacs look the same, use this in
808 @file{~/.emacs.d/gtkrc}:
811 widget_class "*Menu*" style "my_menu_style"
815 @appendixsubsec GTK styles
818 In a GTK style you specify the appearance widgets shall have. You
819 can specify foreground and background color, background pixmap and
820 font. The edit widget (where you edit the text) in Emacs is a GTK
821 widget, but trying to specify a style for the edit widget will have no
822 effect. This is so that Emacs compiled for GTK is compatible with
823 Emacs compiled for other X toolkits. The settings for foreground,
824 background and font for the edit widget is taken from the X resources;
825 @pxref{Resources}. Here is an example of two style declarations,
826 @samp{default} and @samp{ruler}:
829 pixmap_path "/usr/share/pixmaps:/usr/include/X11/pixmaps"
833 font_name = "helvetica 12"
835 bg[NORMAL] = @{ 0.83, 0.80, 0.73 @}
836 bg[SELECTED] = @{ 0.0, 0.55, 0.55 @}
837 bg[INSENSITIVE] = @{ 0.77, 0.77, 0.66 @}
838 bg[ACTIVE] = @{ 0.0, 0.55, 0.55 @}
839 bg[PRELIGHT] = @{ 0.0, 0.55, 0.55 @}
842 fg[SELECTED] = @{ 0.9, 0.9, 0.9 @}
844 fg[PRELIGHT] = @{ 0.9, 0.9, 0.9 @}
846 base[INSENSITIVE] = "#777766"
847 text[INSENSITIVE] = @{ 0.60, 0.65, 0.57 @}
849 bg_pixmap[NORMAL] = "background.xpm"
850 bg_pixmap[INSENSITIVE] = "background.xpm"
851 bg_pixmap[ACTIVE] = "background.xpm"
852 bg_pixmap[PRELIGHT] = "<none>"
856 style "ruler" = "default"
858 font_name = "helvetica 8"
863 The style @samp{ruler} inherits from @samp{default}. This way you can build
864 on existing styles. The syntax for fonts and colors is described below.
866 As this example shows, it is possible to specify several values for
867 foreground and background depending on the widget's @dfn{state}. The
872 This is the default state for widgets.
874 This is the state for a widget that is ready to do something. It is
875 also for the trough of a scroll bar, i.e. @code{bg[ACTIVE] = "red"}
876 sets the scroll bar trough to red. Buttons that have been pressed but
877 not released yet (``armed'') are in this state.
879 This is the state when widgets that can be manipulated have the mouse
880 pointer over them. For example when the mouse is over the thumb in the
881 scroll bar or over a menu item. When the mouse is over a button that
882 is not pressed, the button is in this state.
884 This is the state when some data has been selected by the user. It can
885 be selected text or items selected in a list.
886 There is no place in Emacs where this setting has any effect.
888 This is the state for widgets that are visible, but they can not be
889 manipulated in the usual way---for example, buttons that can't be
890 pressed, and disabled menu items. To display disabled menu items in
891 yellow, use @code{fg[INSENSITIVE] = "yellow"}.
894 Here are the things that can go in a style declaration:
897 @item bg[@var{state}] = @var{color}
898 This specifies the background color for the widget. Note that
899 editable text doesn't use @code{bg}; it uses @code{base} instead.
901 @item base[@var{state}] = @var{color}
902 This specifies the background color for editable text. In Emacs, this
903 color is used for the background of the text fields in the file
906 @item bg_pixmap[@var{state}] = "@var{pixmap}"
907 This specifies an image background (instead of a background color).
908 @var{pixmap} should be the image file name. GTK can use a number of
909 image file formats, including XPM, XBM, GIF, JPEG and PNG. If you
910 want a widget to use the same image as its parent, use
911 @samp{<parent>}. If you don't want any image, use @samp{<none>}.
912 @samp{<none>} is the way to cancel a background image inherited from a
915 You can't specify the file by its absolute file name. GTK looks for
916 the pixmap file in directories specified in @code{pixmap_path}.
917 @code{pixmap_path} is a colon-separated list of directories within
918 double quotes, specified at the top level in a @file{gtkrc} file
919 (i.e. not inside a style definition; see example above):
922 pixmap_path "/usr/share/pixmaps:/usr/include/X11/pixmaps"
925 @item fg[@var{state}] = @var{color}
926 This specifies the foreground color for widgets to use. It is the
927 color of text in menus and buttons, and the color for the arrows in
928 the scroll bar. For editable text, use @code{text}.
930 @item text[@var{state}] = @var{color}
931 This is the color for editable text. In Emacs, this color is used for the
932 text fields in the file dialog.
934 @item font_name = "@var{font}"
935 This specifies the the font for text in the widget. @var{font} is a
936 Pango font name, for example @samp{Sans Italic 10}, @samp{Helvetica
937 Bold 12}, @samp{Courier 14}, @samp{Times 18}. See below for exact
938 syntax. The names are case insensitive.
941 There are three ways to specify a color: by name, in hexadecimal
942 form, and with an RGB triplet.
945 A color name is written within double quotes, for example @code{"red"}.
948 Hexadecimal form is the same as in X:
949 @code{#@var{rrrr}@var{gggg}@var{bbbb}}, where all three color specs
950 must have the same number of hex digits (1, 2, 3 or 4).
953 An RGB triplet looks like @code{@{ @var{r}, @var{g}, @var{b} @}},
954 where @var{r}, @var{g} and @var{b} are either integers in the range
955 0-65535 or floats in the range 0.0-1.0.
957 Pango font names have the form ``@var{family-list} @var{style-options}
959 @cindex Pango font name
961 @var{family-list} is a comma separated list of font families optionally
962 terminated by a comma. This way you can specify several families and the
963 first one found will be used. @var{family} corresponds to the second part in
964 an X font name, for example in
967 -adobe-times-medium-r-normal--12-120-75-75-p-64-iso10646-1
971 the family name is ``times''.
974 @var{style-options} is a whitespace separated list of words where each word
975 is a style, variant, weight, or stretch. The default value for all of
976 these is @code{normal}.
979 A `style' corresponds to the fourth part of an X font name. In X font
980 names it is the character @samp{r}, @samp{i} or @samp{o}; in Pango
981 font names the corresponding values are @code{normal}, @code{italic},
985 A `variant' is either @code{normal} or @code{small-caps}.
986 Small caps is a font with the lower case characters replaced by
987 smaller variants of the capital characters.
990 Weight describes the ``boldness'' of a font. It corresponds to the third
991 part of an X font name. It is one of @code{ultra-light}, @code{light},
992 @code{normal}, @code{bold}, @code{ultra-bold}, or @code{heavy}.
995 Stretch gives the width of the font relative to other designs within a
996 family. It corresponds to the fifth part of an X font name. It is one of
997 @code{ultra-condensed}, @code{extra-condensed}, @code{condensed},
998 @code{semi-condensed}, @code{normal}, @code{semi-expanded},
999 @code{expanded}, @code{extra-expanded}, or @code{ultra-expanded}.
1002 @var{size} is a decimal number that describes the font size in points.
1005 arch-tag: 9b6ff773-48b6-41f6-b2f9-f114b8bdd97f