Add arch taglines
[bpt/emacs.git] / man / xresources.texi
CommitLineData
94249313 1@c This is part of the Emacs manual.
488dd4c4 2@c Copyright (C) 1987,93,94,95,1997,2001,03 Free Software Foundation, Inc.
94249313
RS
3@c See file emacs.texi for copying conditions.
4@node X Resources, Antinews, Command Arguments, Top
82f6e63d 5@appendix X Options and Resources
94249313 6
82f6e63d 7 You can customize some X-related aspects of Emacs behavior using X
8c1691d8
JR
8resources, as is usual for programs that use X. On MS-Windows, you
9can customize some of the same aspects using the system registry.
10@xref{MS-Windows Registry}. X resources are the only way to customize
11tooltip windows and LessTif menus, since the libraries that implement
12them don't provide for customization through Emacs. This appendix
13describes the X resources that Emacs recognizes and how to use them.
405f4489
RS
14
15@menu
82f6e63d
RS
16* Resources:: Using X resources with Emacs (in general).
17* Table of Resources:: Table of specific X resources that affect Emacs.
18* Face Resources:: X resources for customizing faces.
405f4489
RS
19* Lucid Resources:: X resources for Lucid menus.
20* LessTif Resources:: X resources for LessTif and Motif menus.
488dd4c4 21* GTK resources:: Resources for GTK widgets.
405f4489
RS
22@end menu
23
113c2ede 24@node Resources
94249313
RS
25@appendixsec X Resources
26@cindex resources
4fc31427
RS
27@cindex X resources
28@cindex @file{~/.Xdefaults} file
29@cindex @file{~/.Xresources} file
94249313 30
9b7e4229
RS
31 Programs running under the X Window System organize their user
32options under a hierarchy of classes and resources. You can specify
33default values for these options in your X resources file, usually
02e740dc
DL
34named @file{~/.Xdefaults} or @file{~/.Xresources}.
35If changes in @file{~/.Xdefaults} do not
9b7e4229
RS
36take effect, it is because your X server stores its own list of
37resources; to update them, use the shell command @command{xrdb}---for
38instance, @samp{xrdb ~/.Xdefaults}.
94249313
RS
39
40 Each line in the file specifies a value for one option or for a
41collection of related options, for one program or for several programs
42(optionally even for all programs).
43
44@cindex Registry (MS-Windows)
94249313
RS
45 MS-Windows systems don't support @file{~/.Xdefaults} files, but
46Emacs compiled for Windows looks for X resources in the Windows
eca274b1
RS
47Registry, under the key @samp{HKEY_CURRENT_USER\SOFTWARE\GNU\Emacs}
48and then under the key @samp{HKEY_LOCAL_MACHINE\SOFTWARE\GNU\Emacs}.
b15fa8b1
JR
49The menu and scrollbars are native widgets on MS-Windows, so they are
50only customizable via the system-wide settings in the Display Control
51Panel.
94249313
RS
52
53 Programs define named resources with particular meanings. They also
54define how to group resources into named classes. For instance, in
55Emacs, the @samp{internalBorder} resource controls the width of the
56internal border, and the @samp{borderWidth} resource controls the width
57of the external border. Both of these resources are part of the
58@samp{BorderWidth} class. Case distinctions are significant in these
59names.
60
61 In @file{~/.Xdefaults}, you can specify a value for a single resource
62on one line, like this:
63
64@example
65emacs.borderWidth: 2
66@end example
67
68@noindent
69Or you can use a class name to specify the same value for all resources
70in that class. Here's an example:
71
72@example
73emacs.BorderWidth: 2
74@end example
75
76 If you specify a value for a class, it becomes the default for all
77resources in that class. You can specify values for individual
78resources as well; these override the class value, for those particular
79resources. Thus, this example specifies 2 as the default width for all
80borders, but overrides this value with 4 for the external border:
81
82@example
83emacs.BorderWidth: 2
84emacs.borderWidth: 4
85@end example
86
87 The order in which the lines appear in the file does not matter.
88Also, command-line options always override the X resources file.
89
90 The string @samp{emacs} in the examples above is also a resource
91name. It actually represents the name of the executable file that you
92invoke to run Emacs. If Emacs is installed under a different name, it
93looks for resources under that name instead of @samp{emacs}.
94
95@table @samp
96@item -name @var{name}
97@opindex --name
98@itemx --name=@var{name}
99@cindex resource name, command-line argument
100Use @var{name} as the resource name (and the title) for the initial
101Emacs frame. This option does not affect subsequent frames, but Lisp
102programs can specify frame names when they create frames.
103
104If you don't specify this option, the default is to use the Emacs
105executable's name as the resource name.
106
107@item -xrm @var{resource-values}
108@opindex --xrm
109@itemx --xrm=@var{resource-values}
110@cindex resource values, command-line argument
111Specify X resource values for this Emacs job (see below).
112@end table
113
114 For consistency, @samp{-name} also specifies the name to use for
115other resource values that do not belong to any particular frame.
116
117 The resources that name Emacs invocations also belong to a class; its
118name is @samp{Emacs}. If you write @samp{Emacs} instead of
119@samp{emacs}, the resource applies to all frames in all Emacs jobs,
120regardless of frame titles and regardless of the name of the executable
121file. Here is an example:
122
123@example
124Emacs.BorderWidth: 2
125Emacs.borderWidth: 4
126@end example
127
128 You can specify a string of additional resource values for Emacs to
129use with the command line option @samp{-xrm @var{resources}}. The text
130@var{resources} should have the same format that you would use inside a file
131of X resources. To include multiple resource specifications in
132@var{resources}, put a newline between them, just as you would in a file.
133You can also use @samp{#include "@var{filename}"} to include a file full
134of resource specifications. Resource values specified with @samp{-xrm}
135take precedence over all other resource specifications.
136
82f6e63d
RS
137 One way to experiment with the effect of different resource settings
138is to use the @code{editres} program. Select @samp{Get Tree} from the
139@samp{Commands} menu, then click on an Emacs frame. This will display
140a tree showing the structure of X toolkit widgets used in an Emacs
141frame. Select one of them, such as @samp{menubar}, then select
142@samp{Show Resource Box} from the @samp{Commands} menu. This displays
143a list of all the meaningful X resources and allows you to edit them.
144Changes take effect immediately if you click on the @samp{Apply} button.
145
146@node Table of Resources
147@appendixsec Table of X Resources for Emacs
148
149 This table lists the resource names that designate options for
9b7e4229
RS
150Emacs, not counting those for the appearance of the menu bar, each
151with the class that it belongs to:
94249313
RS
152
153@table @asis
154@item @code{background} (class @code{Background})
155Background color name.
156
157@item @code{bitmapIcon} (class @code{BitmapIcon})
158Use a bitmap icon (a picture of a gnu) if @samp{on}, let the window
159manager choose an icon if @samp{off}.
160
161@item @code{borderColor} (class @code{BorderColor})
162Color name for the external border.
163
164@item @code{borderWidth} (class @code{BorderWidth})
165Width in pixels of the external border.
166
167@item @code{cursorColor} (class @code{Foreground})
168Color name for text cursor (point).
169
170@item @code{font} (class @code{Font})
171Font name for text (or fontset name, @pxref{Fontsets}).
172
173@item @code{foreground} (class @code{Foreground})
174Color name for text.
175
176@item @code{geometry} (class @code{Geometry})
177Window size and position. Be careful not to specify this resource as
178@samp{emacs*geometry}, because that may affect individual menus as well
179as the Emacs frame itself.
180
181If this resource specifies a position, that position applies only to the
182initial Emacs frame (or, in the case of a resource for a specific frame
183name, only that frame). However, the size, if specified here, applies to
184all frames.
185
e1556251 186@item @code{fullscreen} (class @code{Fullscreen})
cf225974
EZ
187The desired fullscreen size. The value can be one of @code{fullboth},
188@code{fullwidth} or @code{fullheight}, which correspond to
189the command-line options @samp{-fs}, @samp{-fw}, and @samp{-fh}
190(@pxref{Window Size X}).
e1556251
EZ
191
192Note that this applies to all frames created, not just the initial
193one.
194
94249313
RS
195@item @code{iconName} (class @code{Title})
196Name to display in the icon.
197
198@item @code{internalBorder} (class @code{BorderWidth})
199Width in pixels of the internal border.
200
201@item @code{lineSpacing} (class @code{LineSpacing})
202@cindex line spacing
203@cindex leading
204Additional space (@dfn{leading}) between lines, in pixels.
205
206@item @code{menuBar} (class @code{MenuBar})
d90a6f50 207@cindex menu bar
9b7e4229
RS
208Give frames menu bars if @samp{on}; don't have menu bars if
209@samp{off}. @xref{Lucid Resources}, and @ref{LessTif Resources}, for
210how to control the appearance of the menu bar if you have one.
94249313 211
94249313
RS
212@item @code{minibuffer} (class @code{Minibuffer})
213If @samp{none}, don't make a minibuffer in this frame.
214It will use a separate minibuffer frame instead.
215
216@item @code{paneFont} (class @code{Font})
217@cindex font for menus
218Font name for menu pane titles, in non-toolkit versions of Emacs.
219
220@item @code{pointerColor} (class @code{Foreground})
221Color of the mouse cursor.
222
94249313
RS
223@item @code{privateColormap} (class @code{PrivateColormap})
224If @samp{on}, use a private color map, in the case where the ``default
225visual'' of class PseudoColor and Emacs is using it.
94249313
RS
226
227@item @code{reverseVideo} (class @code{ReverseVideo})
228Switch foreground and background default colors if @samp{on}, use colors as
229specified if @samp{off}.
230
231@item @code{screenGamma} (class @code{ScreenGamma})
232@cindex gamma correction
233Gamma correction for colors, equivalent to the frame parameter
234@code{screen-gamma}.
235
02e740dc 236@item @code{selectionFont} (class @code{SelectionFont})
94249313
RS
237Font name for pop-up menu items, in non-toolkit versions of Emacs. (For
238toolkit versions, see @ref{Lucid Resources}, also see @ref{LessTif
239Resources}.)
240
02e740dc
DL
241@item @code{selectionTimeout} (class @code{SelectionTimeout})
242Number of milliseconds to wait for a selection reply.
243If the selection owner doesn't reply in this time, we give up.
244A value of 0 means wait as long as necessary.
245
94249313
RS
246@item @code{synchronous} (class @code{Synchronous})
247@cindex debugging X problems
248@cindex synchronous X mode
249Run Emacs in synchronous mode if @samp{on}. Synchronous mode is
250useful for debugging X problems.
251
252@item @code{title} (class @code{Title})
253Name to display in the title bar of the initial Emacs frame.
254
4fc31427 255@item @code{toolBar} (class @code{ToolBar})
d90a6f50 256@cindex tool bar
4fc31427
RS
257Number of lines to reserve for the tool bar. A zero value suppresses
258the tool bar. If the value is non-zero and
259@code{auto-resize-tool-bars} is non-@code{nil}, the tool bar's size
260will be changed automatically so that all tool bar items are visible.
261
d90a6f50
DL
262@item @code{useXIM} (class @code{UseXIM})
263@cindex XIM
264@cindex X input methods
265@cindex input methods, X
266Turn off use of X input methods (XIM) if @samp{false} or @samp{off}.
267This is only relevant if your Emacs is actually built with XIM
268support. It is potentially useful to turn off XIM for efficiency,
269especially slow X client/server links.
270
94249313
RS
271@item @code{verticalScrollBars} (class @code{ScrollBars})
272Give frames scroll bars if @samp{on}; don't have scroll bars if
273@samp{off}.
274@end table
275
82f6e63d
RS
276@node Face Resources
277@appendixsec X Resources for Faces
278
279 You can also use resources to customize the appearance of particular
280faces (@pxref{Faces}):
94249313
RS
281
282@table @code
283@item @var{face}.attributeFont
284Font for face @var{face}.
285@item @var{face}.attributeForeground
286Foreground color for face @var{face}.
287@item @var{face}.attributeBackground
288Background color for face @var{face}.
289@item @var{face}.attributeUnderline
290Underline flag for face @var{face}. Use @samp{on} or @samp{true} for
291yes.
292@item @var{face}.attributeFamily
293Font family for face @var{face}.
294@item @var{face}.attributeWidth
295Relative proportional width of the font to use for face @var{face}.
296It should be one of @code{ultra-condensed}, @code{extra-condensed},
297@code{condensed}, @code{semi-condensed}, @code{normal},
298@code{semi-expanded}, @code{expanded}, @code{extra-expanded}, or
299@code{ultra-expanded}.
300@item @var{face}.attributeHeight
301Height of the font to use for face @var{face}: either an integer
302specifying the height in units of 1/10@dmn{pt}, or a floating point
303number that specifies a scale factor to scale the underlying face's
304default font, or a function to be called with the default height which
305will return a new height.
306@item @var{face}.attributeWeight
307A weight to use for the face @var{face}. It must be one of
308@code{ultra-bold}, @code{extra-bold}, @code{bold},
309@code{semi-bold}, @code{normal}, @code{semi-light}, @code{light},
310@code{extra-light}, @code{ultra-light}.
311@item @var{face}.attributeSlant
312The slant to use for the font of face @var{face}. It must be one of
313@code{italic}, @code{oblique}, @code{normal},
314@code{reverse-italic}, or @code{reverse-oblique}.
315@item @var{face}.attributeStrikeThrough
316Whether the face @var{face} should be drawn with a line striking
317through the characters.
318@item @var{face}.attributeOverline
319Whether the characters in the face @var{face} should be overlined.
320@item @var{face}.attributeBox
321Whether to draw a box around the characters in face @var{face}.
322@item @var{face}.attributeInverse
323Whether to display the characters in face @var{face} in inverse
324video.
325@item @var{face}.attributeStipple
326The name of a pixmap data file to use for the stipple pattern, or
327@code{false} to not use stipple for the face @var{face}.
328@item @var{face}.attributeBackgroundPixmap
329The background pixmap for the face @var{face}. Should be a name of a
330pixmap file or @code{false}.
331@item @var{face}.attributeBold
332Whether to draw the characters in the face @var{face} as bold.
333@item @var{face}.attributeItalic
334Whether to draw the characters in the face @var{face} as italic.
335@end table
336
337@node Lucid Resources
338@appendixsec Lucid Menu X Resources
339@cindex Menu X Resources (Lucid widgets)
340@cindex Lucid Widget X Resources
341
342 If the Emacs installed at your site was built to use the X toolkit
343with the Lucid menu widgets, then the menu bar is a separate widget and
344has its own resources. The resource names contain @samp{pane.menubar}
345(following, as always, the name of the Emacs invocation, or @samp{Emacs},
346which stands for all Emacs invocations). Specify them like this:
347
348@example
349Emacs.pane.menubar.@var{resource}: @var{value}
350@end example
351
352@noindent
353For example, to specify the font @samp{8x16} for the menu-bar items,
354write this:
355
356@example
357Emacs.pane.menubar.font: 8x16
358@end example
359
360@noindent
361Resources for @emph{non-menubar} toolkit pop-up menus have
362@samp{menu*}, in like fashion. For example, to specify the font
363@samp{8x16} for the pop-up menu items, write this:
364
365@example
366Emacs.menu*.font: 8x16
367@end example
368
369@noindent
370For dialog boxes, use @samp{dialog} instead of @samp{menu}:
371
372@example
373Emacs.dialog*.font: 8x16
374@end example
375
376@noindent
377Experience shows that on some systems you may need to add
378@samp{shell.}@: before the @samp{pane.menubar} or @samp{menu*}. On
379some other systems, you must not add @samp{shell.}.
380
381 Here is a list of the specific resources for menu bars and pop-up menus:
382
383@table @code
384@item font
385Font for menu item text.
386@item foreground
387Color of the foreground.
388@item background
389Color of the background.
390@item buttonForeground
391In the menu bar, the color of the foreground for a selected item.
392@item horizontalSpacing
393Horizontal spacing in pixels between items. Default is 3.
394@item verticalSpacing
395Vertical spacing in pixels between items. Default is 1.
396@item arrowSpacing
397Horizontal spacing between the arrow (which indicates a submenu) and
398the associated text. Default is 10.
399@item shadowThickness
400Thickness of shadow line around the widget.
401@item margin
402The margin of the menu bar, in characters. The default of 4 makes the
403menu bar appear like the LessTif/Motif one.
404@end table
405
406@node LessTif Resources
407@appendixsec LessTif Menu X Resources
408@cindex Menu X Resources (LessTif widgets)
409@cindex LessTif Widget X Resources
410
411 If the Emacs installed at your site was built to use the X toolkit
412with the LessTif or Motif widgets, then the menu bar, the dialog
413boxes, the pop-up menus, and the file-selection box are separate
414widgets and have their own resources.
415
416 The resource names for the menu bar contain @samp{pane.menubar}
417(following, as always, the name of the Emacs invocation, or
418@samp{Emacs}, which stands for all Emacs invocations). Specify them
419like this:
420
421@smallexample
422Emacs.pane.menubar.@var{subwidget}.@var{resource}: @var{value}
423@end smallexample
424
425 Each individual string in the menu bar is a subwidget; the subwidget's
426name is the same as the menu item string. For example, the word
427@samp{File} in the menu bar is part of a subwidget named
428@samp{emacs.pane.menubar.File}. Most likely, you want to specify the
429same resources for the whole menu bar. To do this, use @samp{*} instead
430of a specific subwidget name. For example, to specify the font
431@samp{8x16} for the menu-bar items, write this:
432
433@smallexample
434Emacs.pane.menubar.*.fontList: 8x16
435@end smallexample
436
437@noindent
438This also specifies the resource value for submenus.
439
440 Each item in a submenu in the menu bar also has its own name for X
441resources; for example, the @samp{File} submenu has an item named
442@samp{Save (current buffer)}. A resource specification for a submenu
443item looks like this:
444
445@smallexample
446Emacs.pane.menubar.popup_*.@var{menu}.@var{item}.@var{resource}: @var{value}
447@end smallexample
448
449@noindent
450For example, here's how to specify the font for the @samp{Save (current
451buffer)} item:
452
453@smallexample
454Emacs.pane.menubar.popup_*.File.Save (current buffer).fontList: 8x16
455@end smallexample
456
457@noindent
458For an item in a second-level submenu, such as @samp{Complete Word}
459under @samp{Spell Checking} under @samp{Tools}, the resource fits this
460template:
461
462@smallexample
463Emacs.pane.menubar.popup_*.popup_*.@var{menu}.@var{resource}: @var{value}
464@end smallexample
465
466@noindent
467For example,
468
469@smallexample
470Emacs.pane.menubar.popup_*.popup_*.Spell Checking.Complete Word: @var{value}
471@end smallexample
472
473@noindent
474(This should be one long line.)
177c0ea7 475
94249313
RS
476 It's impossible to specify a resource for all the menu-bar items
477without also specifying it for the submenus as well. So if you want the
478submenu items to look different from the menu bar itself, you must ask
479for that in two steps. First, specify the resource for all of them;
480then, override the value for submenus alone. Here is an example:
481
482@smallexample
483Emacs.pane.menubar.*.fontList: 8x16
484Emacs.pane.menubar.popup_*.fontList: 8x16
485@end smallexample
486
487@noindent
488For LessTif pop-up menus, use @samp{menu*} instead of
489@samp{pane.menubar}. For example, to specify the font @samp{8x16} for
490the pop-up menu items, write this:
491
492@smallexample
493Emacs.menu*.fontList: 8x16
494@end smallexample
495
496@noindent
497For LessTif dialog boxes, use @samp{dialog} instead of @samp{menu}:
498
499@example
500Emacs.dialog*.fontList: 8x16
501Emacs.dialog*.foreground: hotpink
502@end example
503
504To specify resources for the LessTif file-selection box, use
505@samp{fsb*}, like this:
506
507@example
508Emacs.fsb*.fontList: 8x16
509@end example
510
511@iftex
512@medbreak
513@end iftex
514 Here is a list of the specific resources for LessTif menu bars and
515pop-up menus:
516
517@table @code
518@item armColor
519The color to show in an armed button.
520@item fontList
521The font to use.
522@item marginBottom
523@itemx marginHeight
524@itemx marginLeft
525@itemx marginRight
526@itemx marginTop
527@itemx marginWidth
528Amount of space to leave around the item, within the border.
529@item borderWidth
530The width of the border around the menu item, on all sides.
531@item shadowThickness
532The width of the border shadow.
533@item bottomShadowColor
534The color for the border shadow, on the bottom and the right.
535@item topShadowColor
536The color for the border shadow, on the top and the left.
537@end table
488dd4c4
JD
538
539
540@node GTK resources
541@appendixsec GTK resources
542@cindex GTK resources and customization
543@cindex resource files for GTK
544@cindex @file{~/.gtkrc-2.0} file
545@cindex @file{~/.emacs.d/gtkrc} file
546
547 If the Emacs installed at your site was built to use the GTK widget set,
548then the menu bar, scroll bar and the dialogs can be customized with
549the standard GTK @file{~/.gtkrc-2.0} file or with the Emacs specific
177c0ea7 550@file{~/.emacs.d/gtkrc} file; note that these files are only for
488dd4c4
JD
551customizing specific GTK widget features. To customize Emacs font,
552background, faces etc., use the normal X resources, see @ref{Resources}.
553
554In these files you first defines a style and then how to apply that style
555to widgets (@pxref{GTK widget names}). Here is an example of how to
556change the font for Emacs menus:
557
558@smallexample
559# This is a comment.
560style "menufont"
561@{
562 font_name = "helvetica bold 14" # This is a Pango font name
563@}
564
565widget "*emacs-menuitem*" style "menufont"
566
567@end smallexample
568
569 There are some things you can set without using any style or widget name,
570which affect GTK as a whole. Most of these are poorly documented, but can
571be found in the `Properties' section of the documentation page for
572@code{GtkSetting}, in the GTK document references below.
573
574One property of interest is @code{gtk-font-name} which sets the default
575font for GTK; you must use Pango font names (@pxref{GTK styles}). A
576@file{~/.gtkrc-2.0} file that just sets a default font looks like this:
577
578@smallexample
579gtk-font-name = "courier 12"
580@end smallexample
581
582
583 If GTK at your site is installed under @var{prefix},
584the resource file syntax is fully described in the GTK API
177c0ea7 585document
488dd4c4
JD
586@file{@var{prefix}/share/gtk-doc/html/gtk/gtk-resource-files.html}.
587@var{prefix} is usually @file{/usr} or @file{/usr/local}.
588You can find the same document online at
589@uref{http://developer.gnome.org/doc/API/2.0/gtk/gtk-Resource-Files.html}.
590
591
592@menu
593* GTK widget names:: How widgets in GTK are named in general.
594* GTK names in Emacs:: GTK widget names in Emacs.
595* GTK styles:: What can be customized in a GTK widget.
596@end menu
597
598
599@node GTK widget names
600@appendixsubsec GTK widget names
601@cindex GTK widget names
602
177c0ea7 603 Widgets are specified by widget class or by widget name.
488dd4c4
JD
604The widget class is the type of the widget, for example @code{GtkMenuBar}.
605The widget name is the name given to a specific widget within a program.
606A widget always have a class but it is not mandatory to give a name to
607a widget. Absolute names are sequences of widget names or
608widget classes, corresponding to hierarchies of widgets embedded within
609other widgets. For example, if a @code{GtkWindow} contains a @code{GtkVBox}
610which in turn contains a @code{GtkMenuBar}, the absolute class name
611is @code{GtkWindow.GtkVBox.GtkMenuBar}.
612
613@noindent
614If the widgets are named ``top'', ``box'' and ``menubar'', the absolute
615widget name is @code{top.box.menubar},
616
617 When assigning a style to a widget, you can use the absolute class
618name or the absolute widget name.
619There are two commands: @code{widget_class} will assign a style to
620widgets, matching only against the absolute class name.
621The command @code{widget} will match the absolute widget name,
622but if there is no name for a widget in the hierarchy, the class is matched.
623These commands require the absolute name and the style name to be
624within double quotes. These commands are written at the top level in a
625@file{~/.gtkrc-2.0} file, like this:
626
627@smallexample
628style "menufont"
629@{
630 font_name = "helvetica bold 14"
631@}
632
633widget "top.box.menubar" style "menufont"
634widget_class "GtkWindow.GtkVBox.GtkMenuBar" style "menufont"
635@end smallexample
636
637
638 Matching of absolute names is done with shell ``glob'' syntax, that is
639@samp{*} matches zero or more characters and @samp{?} matches one character.
640So the following would assign @code{base_style} to all widgets:
641
642@smallexample
643widget "*" style "base_style"
644@end smallexample
645
646 Given the absolute class name @code{GtkWindow.GtkVBox.GtkMenuBar}
647and the corresponding absolute widget name @code{top.box.menubar},
648the following all assign @code{my_style} to the menu bar:
649
650@smallexample
651widget_class "GtkWindow.GtkVBox.GtkMenuBar" style "my_style"
652widget_class "GtkWindow.*.GtkMenuBar" style "my_style"
653widget_class "*GtkMenuBar" style "my_style"
654widget "top.box.menubar" style "my_style"
655widget "*box*menubar" style "my_style"
656widget "*menubar" style "my_style"
657widget "*menu*" style "my_style"
658@end smallexample
659
660@node GTK names in Emacs
661@appendixsubsec GTK names in Emacs
662@cindex GTK widget names
663@cindex GTK widget classes
664
665 In Emacs the top level widget for a frame is a @code{GtkWindow} that
177c0ea7
JB
666contains a @code{GtkVBox}. The @code{GtkVBox} contains the
667@code{GtkMenuBar} and a @code{GtkFixed} widget.
488dd4c4
JD
668The vertical scroll bars, @code{GtkVScrollbar},
669are contained in the @code{GtkFixed} widget.
670The text you write in Emacs is drawn in the @code{GtkFixed} widget.
671
672 Dialogs in Emacs are @code{GtkDialog} widgets. The file dialog is a
673@code{GtkFileSelection} widget.
674
675@noindent
676To set a style for the menu bar using the absolute class name, use:
677
678@smallexample
679widget_class "GtkWindow.GtkVBox.GtkMenuBar" style "my_style"
680@end smallexample
681
682@noindent
683For the scroll bar, the absolute class name is:
684
685@smallexample
177c0ea7 686widget_class
488dd4c4
JD
687 "GtkWindow.GtkVBox.GtkFixed.GtkVScrollbar"
688 style "my_style"
689@end smallexample
690
691@noindent
692The names for the emacs widgets, and their classes, are:
693
694@multitable {@code{verticalScrollbar plus}} {@code{GtkFileSelection} and some}
695@item @code{emacs-filedialog}
696@tab @code{GtkFileSelection}
697@item @code{emacs-dialog}
698@tab @code{GtkDialog}
699@item @code{Emacs}
700@tab @code{GtkWindow}
701@item @code{pane}
702@tab @code{GtkVHbox}
703@item @code{emacs}
704@tab @code{GtkFixed}
488dd4c4
JD
705@item @code{verticalScrollbar}
706@tab @code{GtkVScrollbar}
1094ef26
JD
707@item @code{emacs-toolbar}
708@tab @code{GtkToolbar}
709@item @code{menubar}
710@tab @code{GtkMenuBar}
488dd4c4
JD
711@item @code{emacs-menuitem}
712@tab anything in menus
713@end multitable
714
715@noindent
716Thus, for Emacs you can write the two examples above as:
717
718@smallexample
719widget "Emacs.pane.menubar" style "my_style"
720widget "Emacs.pane.emacs.verticalScrollbar" style "my_style"
721@end smallexample
722
723 GTK absolute names are quite strange when it comes to menus
177c0ea7 724and dialogs. The names do not start with @samp{Emacs}, as they are
488dd4c4
JD
725free-standing windows and not contained (in the GTK sense) by the
726Emacs GtkWindow. To customize the dialogs and menus, use wildcards like this:
727
728@smallexample
729widget "*emacs-dialog*" style "my_dialog_style"
730widget "*emacs-filedialog* style "my_file_style"
731widget "*emacs-menuitem* style "my_menu_style"
732@end smallexample
733
734 An alternative is to put customization into @file{~/.emacs.d/gtkrc}.
735This file is only read by Emacs, so anything in @file{~/.emacs.d/gtkrc}
736affects Emacs but leaves other applications unaffected.
737For example, the drop down menu in the file dialog can not
738be customized by any absolute widget name, only by an absolute
177c0ea7 739class name. This is so because the widgets in the drop down menu does not
488dd4c4
JD
740have names and the menu is not contained in the Emacs GtkWindow.
741To have all menus in Emacs look the same, use this in @file{~/.emacs.d/gtkrc}:
742
743@smallexample
744widget_class "*Menu*" style "my_menu_style"
745@end smallexample
746
747@node GTK styles
748@appendixsubsec GTK styles
749@cindex GTK styles
750
751 In a GTK style you specify the appearance widgets shall have. You
752can specify foreground and background color, background pixmap and font.
753The edit widget (where you edit the text) in Emacs is a GTK widget,
754but trying to specify a style for the edit widget will have no effect.
755This is so that Emacs compiled for GTK is compatible with Emacs compiled
756for other X toolkits. The settings for foreground, background and font
757for the edit widget is taken from the X resources; @pxref{Resources}.
758Here is an example of two style declarations, ``default'' and ``ruler'':
759
760@smallexample
761
762pixmap_path "/usr/share/pixmaps:/usr/include/X11/pixmaps"
763
764style "default"
765@{
766 font_name = "helvetica 12"
767
768 bg[NORMAL] = @{ 0.83, 0.80, 0.73 @}
769 bg[SELECTED] = @{ 0.0, 0.55, 0.55 @}
770 bg[INSENSITIVE] = @{ 0.77, 0.77, 0.66 @}
771 bg[ACTIVE] = @{ 0.0, 0.55, 0.55 @}
772 bg[PRELIGHT] = @{ 0.0, 0.55, 0.55 @}
773
774 fg[NORMAL] = "black"
775 fg[SELECTED] = @{ 0.9, 0.9, 0.9 @}
776 fg[ACTIVE] = "black"
777 fg[PRELIGHT] = @{ 0.9, 0.9, 0.9 @}
778
779 base[INSENSITIVE] = "#777766"
780 text[INSENSITIVE] = @{ 0.60, 0.65, 0.57 @}
781
782 bg_pixmap[NORMAL] = "background.xpm"
783 bg_pixmap[INSENSITIVE] = "background.xpm"
784 bg_pixmap[ACTIVE] = "background.xpm"
177c0ea7 785 bg_pixmap[PRELIGHT] = "<none>"
488dd4c4
JD
786
787@}
788
789style "ruler" = "default"
790@{
791 font_name = "helvetica 8"
792@}
793
794@end smallexample
795
796 The style ``ruler'' inherits from ``default''. This way you can build
797on existing styles. The syntax for fonts and colors is described below.
798
799 As this example shows, it is possible to specify several values
800for foreground and background depending on which state the widget has.
801The possible states are
802@table @code
803@item NORMAL
804This is the default state for widgets.
805@item ACTIVE
806This is the state for a widget that is ready to do something. It is
177c0ea7 807also for the trough of a scroll bar, i.e. @code{bg[ACTIVE] = "red"}
488dd4c4
JD
808sets the scroll bar trough to red. Buttons that have been pressed but
809not released yet (``armed'') are in this state.
810@item PRELIGHT
811This is the state when widgets that can be manipulated have the mouse
812pointer over them. For example when the mouse is over the thumb in the
813scroll bar or over a menu item. When the mouse is over a button that
814is not pressed, the button is in this state.
815@item SELECTED
816This is the state when some data has been selected by the user. It can
817be selected text or items selected in a list.
818There is no place in Emacs where this setting has any effect.
819@item INSENSITIVE
820This is the state for widgets that are visible, but they can not be
821manipulated like they normally can. For example, buttons that can't be
822pressed and menu items that can't be selected.
823Text for menu items that are not available can be set to yellow with
824@code{fg[INSENSITIVE] = "yellow"}.
825@end table
826
827Here are the things that can go in a style declaration:
828
829@table @code
830@item bg[@var{state}] = @var{color}
831This is the background color widgets use. This background is not used for
832editable text, use @code{base} for that.
833
834@item base[@var{state}] = @var{color}
835This is the background color for editable text.
177c0ea7 836In Emacs, this color is used for the background of the text fields in the
488dd4c4
JD
837file dialog.
838
839@item bg_pixmap[@var{state}] = "@var{pixmap}"
840You can specify a pixmap to be used instead of the background color.
841@var{pixmap} is a file name. GTK can use a number of file formats,
842including XPM, XBM, GIF, JPEG and PNG. If you want a widget to use the same
843pixmap as its parent, use @samp{<parent>}. If you don't want any
844pixmap use @samp{<none>}. Using @samp{<none>} can be useful
845if your style inherits a style that does specify a pixmap.
846
847 GTK looks for the pixmap in directories specified in @code{pixmap_path}.
848It is not possible to refer to a file by its absolute path name.
849@code{pixmap_path} is a colon-separated list of directories within double
850quotes, specified at the top level in a @file{gtkrc} file (i.e. not inside
851a style definition; see example above):
852
853@smallexample
854pixmap_path "/usr/share/pixmaps:/usr/include/X11/pixmaps"
855@end smallexample
856
857@item fg[@var{state}] = @var{color}
858This is the foreground color widgets use. This is the color
859of text in menus and buttons. It is also the color for the arrows in the
860scroll bar. For editable text, use @code{text}.
861
862@item text[@var{state}] = @var{color}
177c0ea7 863This is the color for editable text. In Emacs, this color is used for the
488dd4c4
JD
864text fields in the file dialog.
865
866@item font_name = "@var{font}"
867This is the font a widget shall use. @var{font} is a Pango font name,
868for example ``Sans Italic 10'', ``Helvetica Bold 12'', ``Courier 14'',
869``Times 18''. See below for exact syntax. The names are case insensitive.
870@end table
871
872 Colors are specified in three ways, a name, a hexadecimal form or
873an RGB triplet.
874
875@noindent
876A color name is written within double quotes, for example @code{"red"}.
877
878@noindent
879A hexadecimal form is written within double quotes. There are four forms,
177c0ea7 880@code{#rrrrggggbbbb}, @code{#rrrgggbbb},
488dd4c4
JD
881@code{#rrggbb}, or @code{#rgb}. In each of these r, g and b are hex digits.
882
883@noindent
884An RGB triplet looks like @code{@{ r, g, b @}}, where r, g and b are either
885integers in the range 0-65535 or floats in the range 0.0-1.0.
886
887 Pango font names have the form ``@var{family-list} @var{style-options}
888@var{size}''.
889@cindex Pango font name
890@noindent
891@var{family-list} is a comma separated list of font families optionally
892terminated by a comma. This way you can specify several families and the
893first one found will be used. @var{family} corresponds to the second part in
894an X font name, for example in
895
896@smallexample
897-adobe-times-medium-r-normal--12-120-75-75-p-64-iso10646-1
898@end smallexample
899
900@noindent
901the family name is ``times''.
902
903@noindent
904@var{style-options} is a whitespace separated list of words where each word
905is a style, variant, weight, or stretch. The default value for all of
906these is @code{normal}.
907
908@noindent
909A `style' corresponds to the fourth part of an X font name. In X font
910names it is the character ``r'', ``i'' or ``o''; in Pango font names the
911corresponding values are @code{normal}, @code{italic}, or @code{oblique}.
912
913@noindent
914A `variant' is either @code{normal} or @code{small-caps}.
915Small caps is a font with the lower case characters replaced by
916smaller variants of the capital characters.
917
918@noindent
919Weight describes the ``boldness'' of a font. It corresponds to the third
920part of an X font name. It is one of @code{ultra-light}, @code{light},
921@code{normal}, @code{bold}, @code{ultra-bold}, or @code{heavy}.
922
923@noindent
924Stretch gives the width of the font relative to other designs within a
925family. It corresponds to the fifth part of an X font name. It is one of
926@code{ultra-condensed}, @code{extra-condensed}, @code{condensed},
927@code{semi-condensed}, @code{normal}, @code{semi-expanded},
928@code{expanded}, @code{extra-expanded}, or @code{ultra-expanded}.
929
930@noindent
931@var{size} is a decimal number that describes the font size in points.
ab5796a9
MB
932
933@ignore
934 arch-tag: 9b6ff773-48b6-41f6-b2f9-f114b8bdd97f
935@end ignore