1 @c This is part of the Emacs manual.
2 @c Copyright (C) 1987, 1993-1995, 1997, 2001-2018 Free Software
4 @c See file emacs.texi for copying conditions.
6 @appendix X Options and Resources
8 You can customize some X-related aspects of Emacs behavior using X
9 resources, as is usual for programs that use X.
11 When Emacs is compiled with GTK+ support, the appearance of various
12 graphical widgets, such as the menu-bar, scroll-bar, and dialog boxes,
15 GTK resources, which we will also describe.
20 When Emacs is built without GTK+ support, the appearance of these
21 widgets is determined by additional X resources.
23 On MS-Windows, you can customize some of the same aspects using the
24 system registry (@pxref{MS-Windows Registry}).
27 * Resources:: Using X resources with Emacs (in general).
28 * Table of Resources:: Table of specific X resources that affect Emacs.
29 * Lucid Resources:: X resources for Lucid menus.
30 * Motif Resources:: X resources for Motif and LessTif menus.
31 * GTK resources:: Resources for GTK widgets.
35 @appendixsec X Resources
38 @cindex @file{~/.Xdefaults} file
39 @cindex @file{~/.Xresources} file
41 Programs running under the X Window System organize their user
42 options under a hierarchy of classes and resources. You can specify
43 default values for these options in your @dfn{X resource file},
44 usually named @file{~/.Xdefaults} or @file{~/.Xresources}. Changes in
45 this file do not take effect immediately, because the X server stores
46 its own list of resources; to update it, use the command
47 @command{xrdb}---for instance, @samp{xrdb ~/.Xdefaults}.
49 @cindex registry, setting resources (MS-Windows)
50 (MS-Windows systems do not support X resource files; on such systems,
51 Emacs looks for X resources in the Windows Registry, first under the
52 key @samp{HKEY_CURRENT_USER\SOFTWARE\GNU\Emacs}, which affects only
53 the current user and override the system-wide settings, and then under
54 the key @samp{HKEY_LOCAL_MACHINE\SOFTWARE\GNU\Emacs}, which affects
55 all users of the system. The menu and scroll bars are native widgets
56 on MS-Windows, so they are only customizable via the system-wide
57 settings in the Display Control Panel. You can also set resources
58 using the @samp{-xrm} command line option, as explained below.)
60 Each line in the X resource file specifies a value for one option or
61 for a collection of related options. The order in which the lines
62 appear in the file does not matter. Each resource specification
63 consists of a @dfn{program name} and a @dfn{resource name}. Case
64 distinctions are significant in each of these names. Here is an
68 emacs.cursorColor: dark green
71 The program name is the name of the executable file to which the
72 resource applies. For Emacs, this is normally @samp{emacs}. To
73 specify a definition that applies to all instances of Emacs,
74 regardless of the name of the Emacs executable, use @samp{Emacs}.
76 The resource name is the name of a program setting. For instance,
77 Emacs recognizes a @samp{cursorColor} resource that controls the color
80 Resources are grouped into named classes. For instance, the
81 @samp{Foreground} class contains the @samp{cursorColor},
82 @samp{foreground} and @samp{pointerColor} resources (@pxref{Table of
83 Resources}). Instead of using a resource name, you can use a class
84 name to specify the default value for all resources in that class,
88 emacs.Foreground: dark green
91 Emacs does not process X resources at all if you set the variable
92 @code{inhibit-x-resources} to a non-@code{nil} value. If you invoke
93 Emacs with the @samp{-Q} (or @samp{--quick}) command-line option,
94 @code{inhibit-x-resources} is automatically set to @code{t}
95 (@pxref{Initial Options}).
98 In addition, you can use the following command-line options to
99 override the X resources file:
102 @item -name @var{name}
104 @itemx --name=@var{name}
105 @cindex resource name, command-line argument
106 This option sets the program name of the initial Emacs frame to
107 @var{name}. It also sets the title of the initial frame to
108 @var{name}. This option does not affect subsequent frames.
110 If you don't specify this option, the default is to use the Emacs
111 executable's name as the program name.
113 For consistency, @samp{-name} also specifies the name to use for other
114 resource values that do not belong to any particular frame.
116 The resources that name Emacs invocations also belong to a class,
117 named @samp{Emacs}. If you write @samp{Emacs} instead of
118 @samp{emacs}, the resource applies to all frames in all Emacs jobs,
119 regardless of frame titles and regardless of the name of the
122 @item -xrm @var{resource-values}
124 @itemx --xrm=@var{resource-values}
125 @cindex resource values, command-line argument
126 This option specifies X resource values for the present Emacs job.
128 @var{resource-values} should have the same format that you would use
129 inside a file of X resources. To include multiple resource
130 specifications in @var{resource-values}, put a newline between them,
131 just as you would in a file. You can also use @samp{#include
132 "@var{filename}"} to include a file full of resource specifications.
133 Resource values specified with @samp{-xrm} take precedence over all
134 other resource specifications.
138 @node Table of Resources
139 @appendixsec Table of X Resources for Emacs
141 This table lists the X resource names that Emacs recognizes,
142 excluding those that control the appearance of graphical widgets like
146 @item @code{background} (class @code{Background})
147 Background color (@pxref{Colors}).
149 @item @code{bitmapIcon} (class @code{BitmapIcon})
150 Tell the window manager to display the Emacs icon if @samp{on}; don't
151 do so if @samp{off}. @xref{Icons X}, for a description of the icon.
154 @item @code{borderColor} (class @code{BorderColor})
155 Color of the frame's external border. This has no effect if Emacs is
156 compiled with GTK+ support.
158 @item @code{borderWidth} (class @code{BorderWidth})
159 Width of the frame's external border, in pixels. This has no effect
160 if Emacs is compiled with GTK+ support.
163 @item @code{cursorColor} (class @code{Foreground})
164 Text cursor color. If this resource is specified when Emacs starts
165 up, Emacs sets its value as the background color of the @code{cursor}
166 face (@pxref{Faces}).
168 @item @code{cursorBlink} (class @code{CursorBlink})
169 If the value of this resource is @samp{off} or @samp{false} or
170 @samp{0} at startup, Emacs disables Blink Cursor mode (@pxref{Cursor
173 @item @code{font} (class @code{Font})
174 Font name for the @code{default} face (@pxref{Fonts}). You can also
175 specify a fontset name (@pxref{Fontsets}).
177 @item @code{fontBackend} (class @code{FontBackend})
178 Comma-delimited list of backend(s) to use for drawing fonts, in order
179 of precedence. For instance, the value @samp{x,xft} tells Emacs to
180 draw fonts using the X core font driver, falling back on the Xft font
181 driver if that fails. Normally, you should leave this resource unset,
182 in which case Emacs tries using all available font backends.
184 @item @code{foreground} (class @code{Foreground})
185 Default foreground color for text.
187 @item @code{geometry} (class @code{Geometry})
188 Window size and position. The value should be a size and position
189 specification, of the same form as in the @samp{-g} or
190 @samp{--geometry} command-line option (@pxref{Window Size X}).
192 The size applies to all frames in the Emacs session, but the position
193 applies only to the initial Emacs frame (or, in the case of a resource
194 for a specific frame name, only that frame).
197 Be careful not to specify this resource as @samp{emacs*geometry}, as
198 that may affect individual menus as well as the main Emacs frame.
200 @item @code{fullscreen} (class @code{Fullscreen})
201 The desired fullscreen size. The value can be one of @code{fullboth},
202 @code{maximized}, @code{fullwidth} or @code{fullheight}, which
203 correspond to the command-line options @samp{-fs}, @samp{-mm},
204 @samp{-fw}, and @samp{-fh} (@pxref{Window Size X}). Note that this
205 applies to the initial frame only.
208 @item @code{iconName} (class @code{Title})
209 Name to display in the icon.
211 @item @code{internalBorder} (class @code{BorderWidth})
212 Width of the internal frame border, in pixels.
215 @item @code{lineSpacing} (class @code{LineSpacing})
217 Additional space between lines, in pixels.
220 @item @code{menuBackground} (class @code{Background})
221 @cindex background for menus
222 The background color of the menus in non-toolkit versions of Emacs.
223 (For toolkit versions, see @ref{Lucid Resources}, also see @ref{Motif
224 Resources}, and see @ref{GTK resources}.)
227 @item @code{menuBar} (class @code{MenuBar})
228 @cindex menu bar (X resource)
229 If the value of this resource is @samp{off} or @samp{false} or
230 @samp{0}, Emacs disables Menu Bar mode at startup (@pxref{Menu Bars}).
233 @item @code{minibuffer} (class @code{Minibuffer})
234 If @samp{none}, Emacs will not make a minibuffer in this frame; it
235 will use a separate minibuffer frame instead.
237 @item @code{paneFont} (class @code{Font})
238 @cindex font for menus
239 Font name for menu pane titles, in non-toolkit versions of Emacs.
240 (For toolkit versions, see @ref{Lucid Resources}, also see @ref{Motif
241 Resources}, and see @ref{GTK resources}.)
243 @item @code{paneForeground} (class @code{Foreground})
244 @cindex foreground for menus
245 Foreground color for menu pane titles, in non-toolkit versions of
246 Emacs. (For toolkit versions, see @ref{Lucid Resources}, also see
247 @ref{Motif Resources}, and see @ref{GTK resources}.)
250 @item @code{pointerColor} (class @code{Foreground})
251 Color of the mouse cursor. This has no effect in many graphical
252 desktop environments, as they do not let Emacs change the mouse cursor
256 @item @code{privateColormap} (class @code{PrivateColormap})
257 If @samp{on}, use a private color map, in the case where the default
258 visual of class PseudoColor and Emacs is using it.
260 @item @code{reverseVideo} (class @code{ReverseVideo})
261 Switch foreground and background default colors if @samp{on}, use colors as
262 specified if @samp{off}.
264 @item @code{screenGamma} (class @code{ScreenGamma})
265 @cindex gamma correction
266 Gamma correction for colors, equivalent to the frame parameter
269 @item @code{scrollBar} (class @code{ScrollBar})
271 If the value of this resource is @samp{off} or @samp{false} or
272 @samp{0}, Emacs disables Scroll Bar mode at startup (@pxref{Scroll Bars}).
274 @item @code{scrollBarWidth} (class @code{ScrollBarWidth})
275 @cindex scrollbar width
276 The scroll bar width in pixels, equivalent to the frame parameter
277 @code{scroll-bar-width}. Do not set this resource if Emacs is
278 compiled with GTK+ support.
282 @item @code{selectionFont} (class @code{SelectionFont})
283 Font name for pop-up menu items, in non-toolkit versions of Emacs. (For
284 toolkit versions, see @ref{Lucid Resources}, also see @ref{Motif
285 Resources}, and see @ref{GTK resources}.)
287 @item @code{selectionForeground} (class @code{SelectionForeground})
288 Foreground color for pop-up menu items, in non-toolkit versions of
289 Emacs. (For toolkit versions, see @ref{Lucid Resources}, also see
290 @ref{Motif Resources}, and see @ref{GTK resources}.)
292 @item @code{selectionTimeout} (class @code{SelectionTimeout})
293 Number of milliseconds to wait for a selection reply.
294 If the selection owner doesn't reply in this time, we give up.
295 A value of 0 means wait as long as necessary.
297 @item @code{synchronous} (class @code{Synchronous})
298 @cindex debugging X problems
299 @cindex synchronous X mode
300 Run Emacs in synchronous mode if @samp{on}. Synchronous mode is
301 useful for debugging X problems.
304 @item @code{title} (class @code{Title})
305 Name to display in the title bar of the initial Emacs frame.
307 @item @code{toolBar} (class @code{ToolBar})
309 If the value of this resource is @samp{off} or @samp{false} or
310 @samp{0}, Emacs disables Tool Bar mode at startup (@pxref{Tool Bars}).
312 @item @code{useXIM} (class @code{UseXIM})
314 @cindex X input methods
315 @cindex input methods, X
316 Disable use of X input methods (XIM) if @samp{false} or @samp{off}.
317 This is only relevant if your Emacs is built with XIM support. It
318 might be useful to turn off XIM on slow X client/server links.
320 @item @code{verticalScrollBars} (class @code{ScrollBars})
321 Give frames scroll bars if @samp{on}; don't have scroll bars if
325 @item @code{visualClass} (class @code{VisualClass})
326 The @dfn{visual class} for X color display. If specified, the value
327 should start with one of @samp{TrueColor}, @samp{PseudoColor},
328 @samp{DirectColor}, @samp{StaticColor}, @samp{GrayScale}, and
329 @samp{StaticGray}, followed by @samp{-@var{depth}}, where @var{depth}
330 is the number of color planes.
334 You can also use X resources to customize individual Emacs faces
335 (@pxref{Faces}). For example, setting the resource
336 @samp{@var{face}.attributeForeground} is equivalent to customizing the
337 @samp{foreground} attribute of the face @var{face}. However, we
338 recommend customizing faces from within Emacs, instead of using X
339 resources. @xref{Face Customization}.
342 @node Lucid Resources
343 @appendixsec Lucid Menu And Dialog X Resources
344 @cindex Menu X Resources (Lucid widgets)
345 @cindex Dialog X Resources (Lucid widgets)
346 @cindex Lucid Widget X Resources
348 If Emacs is compiled with the X toolkit support using Lucid widgets,
349 you can use X resources to customize the appearance of the menu bar,
350 pop-up menus, and dialog boxes. The resources for the menu bar fall
351 in the @samp{pane.menubar} class (following, as always, either the
352 name of the Emacs executable or @samp{Emacs} for all Emacs
353 invocations). The resources for the pop-up menu are in the
354 @samp{menu*} class. The resources for dialog boxes are in the
355 @samp{dialog*} class.
357 For example, to display menu bar entries with the @samp{Courier-12}
358 font (@pxref{Fonts}), write this:
361 Emacs.pane.menubar.font: Courier-12
365 Lucid widgets can display multilingual text in your locale. To enable
366 this, specify a @code{fontSet} resource instead of a @code{font}
367 resource. @xref{Fontsets}. If both @code{font} and @code{fontSet}
368 resources are specified, the @code{fontSet} resource is used.
370 Here is a list of resources for menu bars, pop-up menus, and dialogs:
374 Font for menu item text.
376 Fontset for menu item text.
381 @item buttonForeground
382 Foreground color for a selected item.
384 @item horizontalSpacing
385 Horizontal spacing in pixels between items. Default is 3.
386 @item verticalSpacing
387 Vertical spacing in pixels between items. Default is 2.
389 Horizontal spacing between the arrow (which indicates a submenu) and
390 the associated text. Default is 10.
391 @item shadowThickness
392 Thickness of shadow lines for 3D buttons, arrows, and other graphical
393 elements. Default is 1.
396 Margin of the menu bar, in characters. Default is 1.
399 @node Motif Resources
400 @appendixsec Motif Menu X Resources
401 @cindex Menu X Resources (Motif widgets)
402 @cindex Motif Widget X Resources
404 If Emacs is compiled with the X toolkit support using Motif or
405 LessTif widgets, you can use X resources to customize the appearance
406 of the menu bar, pop-up menus, and dialog boxes. However, the
407 resources are organized differently from Lucid widgets.
409 The resource names for the menu bar are in the @samp{pane.menubar}
410 class, and they must be specified in this form:
413 Emacs.pane.menubar.@var{subwidget}.@var{resource}: @var{value}
417 For pop-up menus, the resources are in the @samp{menu*} class, instead
418 of @samp{pane.menubar}. For dialog boxes, they are in @samp{dialog}.
419 In each case, each individual menu string is a subwidget; the
420 subwidget's name is the same as the menu item string. For example,
421 the @samp{File} menu in the menu bar is a subwidget named
422 @samp{emacs.pane.menubar.File}.
424 Typically, you want to specify the same resources for the whole menu
425 bar. To do this, use @samp{*} instead of a specific subwidget name.
426 For example, to specify the font @samp{8x16} for all menu bar items,
427 including submenus, write this:
430 Emacs.pane.menubar.*.fontList: 8x16
433 Each item in a submenu also has its own name for X resources; for
434 example, the @samp{File} submenu has an item named @samp{Save (current
435 buffer)}. A resource specification for a submenu item looks like
439 Emacs.pane.menubar.popup_*.@var{menu}.@var{item}.@var{resource}: @var{value}
443 For example, here's how to specify the font for the @samp{Save (current
447 Emacs.pane.menubar.popup_*.File.Save (current buffer).fontList: 8x16
451 For an item in a second-level submenu, such as @samp{Complete Word}
452 under @samp{Spell Checking} under @samp{Tools}, the resource fits this
456 Emacs.pane.menubar.popup_*.popup_*.@var{menu}.@var{resource}: @var{value}
463 Emacs.pane.menubar.popup_*.popup_*.Spell Checking.Complete Word: @var{value}
467 (This should be one long line.)
469 If you want the submenu items to look different from the menu bar
470 itself, you must first specify the resource for all of them, then
471 override the value for submenus alone. Here is an example:
474 Emacs.pane.menubar.*.fontList: 8x16
475 Emacs.pane.menubar.popup_*.fontList: 8x16
478 To specify resources for the LessTif file-selection box, use
479 @samp{fsb*}, like this:
482 Emacs.fsb*.fontList: 8x16
485 Here is a list of resources for LessTif menu bars and pop-up menus:
489 The color to show in an armed button.
498 Amount of space to leave around the item, within the border.
500 The width of the border around the menu item, on all sides.
501 @item shadowThickness
502 The width of the border shadow.
503 @item bottomShadowColor
504 The color for the border shadow, on the bottom and the right.
506 The color for the border shadow, on the top and the left.
511 @appendixsec GTK resources
512 @cindex GTK+ resources
513 @cindex resource files for GTK
514 @cindex @file{~/.gtkrc-2.0} file
515 @cindex @file{~/.emacs.d/gtkrc} file
517 If Emacs is compiled with GTK+ toolkit support, the simplest way to
518 customize its GTK+ widgets (e.g., menus, dialogs, tool bars and
519 scroll bars) is to choose an appropriate GTK+ theme, for example with
520 the GNOME theme selector.
522 In GTK+ version 2, you can also use @dfn{GTK+ resources} to
523 customize the appearance of GTK+ widgets used by Emacs. These
524 resources are specified in either the file @file{~/.emacs.d/gtkrc}
525 (for Emacs-specific GTK+ resources), or @file{~/.gtkrc-2.0} (for
526 general GTK+ resources). We recommend using @file{~/.emacs.d/gtkrc},
527 since GTK+ seems to ignore @file{~/.gtkrc-2.0} when running GConf with
528 GNOME@. Note, however, that some GTK themes may override
529 customizations in @file{~/.emacs.d/gtkrc}; there is nothing we can do
530 about this. GTK+ resources do not affect aspects of Emacs unrelated
531 to GTK+ widgets, such as fonts and colors in the main Emacs window;
532 those are governed by normal X resources (@pxref{Resources}).
534 The following sections describe how to customize GTK+ resources for
535 Emacs. For details about GTK+ resources, see the GTK+ API document at
536 @uref{https://developer.gnome.org/gtk2/stable/gtk2-Resource-Files.html}.
538 In GTK+ version 3, GTK+ resources have been replaced by a completely
539 different system. The appearance of GTK+ widgets is now determined by
540 CSS-like style files: @file{gtk-3.0/gtk.css} in the GTK+ installation
541 directory, and @file{~/.themes/@var{theme}/gtk-3.0/gtk.css} for local
542 style settings (where @var{theme} is the name of the current GTK+
543 theme). Therefore, the description of GTK+ resources in this section
544 does not apply to GTK+ 3. For details about the GTK+ 3 styling
546 @uref{https://developer.gnome.org/gtk3/3.0/GtkCssProvider.html}.
549 * GTK Resource Basics:: Basic usage of GTK+ resources.
550 * GTK Widget Names:: How GTK+ widgets are named.
551 * GTK Names in Emacs:: GTK widgets used by Emacs.
552 * GTK styles:: What can be customized in a GTK widget.
555 @node GTK Resource Basics
556 @appendixsubsec GTK Resource Basics
558 In a GTK+ 2 resource file (usually @file{~/.emacs.d/gtkrc}), the
559 simplest kinds of resource settings simply assign a value to a
560 variable. For example, putting the following line in the resource
561 file changes the font on all GTK+ widgets to @samp{courier-12}:
564 gtk-font-name = "courier 12"
568 Note that in this case the font name must be supplied as a GTK font
569 pattern (also called a @dfn{Pango font name}), not as a
570 Fontconfig-style font name or XLFD@. @xref{Fonts}.
572 To customize widgets you first define a @dfn{style}, and then apply
573 the style to the widgets. Here is an example that sets the font for
574 menus (@samp{#} characters indicate comments):
577 # @r{Define the style @samp{my_style}.}
580 font_name = "helvetica bold 14"
583 # @r{Specify that widget type @samp{*emacs-menuitem*} uses @samp{my_style}.}
584 widget "*emacs-menuitem*" style "my_style"
588 The widget name in this example contains wildcards, so the style is
589 applied to all widgets matching @samp{*emacs-menuitem*}. The widgets
590 are named by the way they are contained, from the outer widget to the
591 inner widget. Here is another example that applies @samp{my_style}
592 specifically to the Emacs menu bar:
595 widget "Emacs.pane.menubar.*" style "my_style"
598 Here is a more elaborate example, showing how to change the parts of
604 fg[NORMAL] = "red"@ @ @ @ @ # @r{Arrow color.}
605 bg[NORMAL] = "yellow"@ @ # @r{Thumb and background around arrow.}
606 bg[ACTIVE] = "blue"@ @ @ @ # @r{Trough color.}
607 bg[PRELIGHT] = "white"@ # @r{Thumb color when the mouse is over it.}
610 widget "*verticalScrollBar*" style "scroll"
613 @node GTK Widget Names
614 @appendixsubsec GTK widget names
615 @cindex GTK widget names
617 A GTK+ widget is specified by a @dfn{widget name} and a @dfn{widget
618 class}. The widget name refers to a specific widget
619 (e.g., @samp{emacs-menuitem}), while the widget class refers to a
620 collection of similar widgets (e.g., @samp{GtkMenuItem}). A widget
621 always has a class, but need not have a name.
623 @dfn{Absolute names} are sequences of widget names or widget
624 classes, corresponding to hierarchies of widgets embedded within
625 other widgets. For example, if a @code{GtkWindow} named @code{top}
626 contains a @code{GtkVBox} named @code{box}, which in turn contains
627 a @code{GtkMenuBar} called @code{menubar}, the absolute class name
628 of the menu-bar widget is @code{GtkWindow.GtkVBox.GtkMenuBar}, and
629 its absolute widget name is @code{top.box.menubar}.
631 GTK+ resource files can contain two types of commands for specifying
636 specifies a style for widgets based on the class name, or just the
640 specifies a style for widgets based on the class name.
644 See the previous subsection for examples of using the @code{widget}
645 command; the @code{widget_class} command is used similarly. Note that
646 the widget name/class and the style must be enclosed in double-quotes,
647 and these commands must be at the top level in the GTK+ resource file.
649 As previously noted, you may specify a widget name or class with
650 shell wildcard syntax: @samp{*} matches zero or more characters and
651 @samp{?} matches one character. This example assigns a style to all
655 widget "*" style "my_style"
658 @node GTK Names in Emacs
659 @appendixsubsec GTK Widget Names in Emacs
660 @cindex GTK widget names in Emacs
661 @cindex GTK widget classes
663 The GTK+ widgets used by an Emacs frame are listed below:
666 @item @code{Emacs} (class @code{GtkWindow})
668 @item @code{pane} (class @code{GtkVBox})
670 @item @code{menubar} (class @code{GtkMenuBar})
672 @item [menu item widgets]
674 @item [unnamed widget] (class @code{GtkHandleBox})
676 @item @code{emacs-toolbar} (class @code{GtkToolbar})
678 @item [tool bar item widgets]
681 @item @code{emacs} (class @code{GtkFixed})
683 @item @code{verticalScrollBar} (class @code{GtkVScrollbar})
690 The contents of Emacs windows are drawn in the @code{emacs} widget.
691 Note that even if there are multiple Emacs windows, each scroll bar
692 widget is named @code{verticalScrollBar}.
694 For example, here are two different ways to set the menu bar style:
697 widget "Emacs.pane.menubar.*" style "my_style"
698 widget_class "GtkWindow.GtkVBox.GtkMenuBar.*" style "my_style"
701 For GTK+ dialogs, Emacs uses a widget named @code{emacs-dialog}, of
702 class @code{GtkDialog}. For file selection, Emacs uses a widget named
703 @code{emacs-filedialog}, of class @code{GtkFileSelection}.
705 Because the widgets for pop-up menus and dialogs are free-standing
706 windows and not contained in the @code{Emacs} widget, their GTK+
707 absolute names do not start with @samp{Emacs}. To customize these
708 widgets, use wildcards like this:
711 widget "*emacs-dialog*" style "my_dialog_style"
712 widget "*emacs-filedialog* style "my_file_style"
713 widget "*emacs-menuitem* style "my_menu_style"
716 If you want to apply a style to all menus in Emacs, use this:
719 widget_class "*Menu*" style "my_menu_style"
723 @appendixsubsec GTK styles
726 Here is an example of two GTK+ style declarations:
729 pixmap_path "/usr/share/pixmaps:/usr/include/X11/pixmaps"
733 font_name = "helvetica 12"
735 bg[NORMAL] = @{ 0.83, 0.80, 0.73 @}
736 bg[SELECTED] = @{ 0.0, 0.55, 0.55 @}
737 bg[INSENSITIVE] = @{ 0.77, 0.77, 0.66 @}
738 bg[ACTIVE] = @{ 0.0, 0.55, 0.55 @}
739 bg[PRELIGHT] = @{ 0.0, 0.55, 0.55 @}
742 fg[SELECTED] = @{ 0.9, 0.9, 0.9 @}
744 fg[PRELIGHT] = @{ 0.9, 0.9, 0.9 @}
746 base[INSENSITIVE] = "#777766"
747 text[INSENSITIVE] = @{ 0.60, 0.65, 0.57 @}
749 bg_pixmap[NORMAL] = "background.xpm"
750 bg_pixmap[INSENSITIVE] = "background.xpm"
751 bg_pixmap[ACTIVE] = "background.xpm"
752 bg_pixmap[PRELIGHT] = "<none>"
756 style "ruler" = "default"
758 font_name = "helvetica 8"
763 The style @samp{ruler} inherits from @samp{default}. This way you can build
764 on existing styles. The syntax for fonts and colors is described below.
766 As this example shows, it is possible to specify several values for
767 foreground and background depending on the widget's @dfn{state}. The
772 This is the default state for widgets.
774 This is the state for a widget that is ready to do something. It is
775 also for the trough of a scroll bar, i.e., @code{bg[ACTIVE] = "red"}
776 sets the scroll bar trough to red. Buttons that have been armed
777 (pressed but not released yet) are in this state.
779 This is the state for a widget that can be manipulated, when the mouse
780 pointer is over it---for example when the mouse is over the thumb in
781 the scroll bar or over a menu item. When the mouse is over a button
782 that is not pressed, the button is in this state.
784 This is the state for data that has been selected by the user. It can
785 be selected text or items selected in a list. This state is not used
788 This is the state for widgets that are visible, but they cannot be
789 manipulated in the usual way---for example, buttons that can't be
790 pressed, and disabled menu items. To display disabled menu items in
791 yellow, use @code{fg[INSENSITIVE] = "yellow"}.
794 Here are the things that can go in a style declaration:
797 @item bg[@var{state}] = @var{color}
798 This specifies the background color for the widget. Note that
799 editable text doesn't use @code{bg}; it uses @code{base} instead.
801 @item base[@var{state}] = @var{color}
802 This specifies the background color for editable text. In Emacs, this
803 color is used for the background of the text fields in the file
806 @item bg_pixmap[@var{state}] = "@var{pixmap}"
807 This specifies an image background (instead of a background color).
808 @var{pixmap} should be the image file name. GTK can use a number of
809 image file formats, including XPM, XBM, GIF, JPEG and PNG@. If you
810 want a widget to use the same image as its parent, use
811 @samp{<parent>}. If you don't want any image, use @samp{<none>}.
812 @samp{<none>} is the way to cancel a background image inherited from a
815 You can't specify the file by its absolute file name. GTK looks for
816 the pixmap file in directories specified in @code{pixmap_path}.
817 @code{pixmap_path} is a colon-separated list of directories within
818 double quotes, specified at the top level in a @file{gtkrc} file
819 (i.e., not inside a style definition; see example above):
822 pixmap_path "/usr/share/pixmaps:/usr/include/X11/pixmaps"
825 @item fg[@var{state}] = @var{color}
826 This specifies the foreground color for widgets to use. It is the
827 color of text in menus and buttons, and the color for the arrows in
828 the scroll bar. For editable text, use @code{text}.
830 @item text[@var{state}] = @var{color}
831 This is the color for editable text. In Emacs, this color is used for the
832 text fields in the file dialog.
834 @item font_name = "@var{font}"
835 This specifies the font for text in the widget. @var{font} is a
836 GTK-style (or Pango) font name, like @samp{Sans Italic 10}.
837 @xref{Fonts}. The names are case insensitive.
840 There are three ways to specify a color: a color name, an RGB
841 triplet, or a GTK-style RGB triplet. @xref{Colors}, for a description
842 of color names and RGB triplets. Color names should be enclosed with
843 double quotes, e.g., @samp{"red"}. RGB triplets should be written
844 without double quotes, e.g., @samp{#ff0000}. GTK-style RGB triplets
845 have the form @w{@code{@{ @var{r}, @var{g}, @var{b} @}}}, where
846 @var{r}, @var{g} and @var{b} are either integers in the range 0--65535
847 or floats in the range 0.0--1.0.