Mercurial > emacs
comparison man/xresources.texi @ 74044:fd7d868143e8
Merge text from xresmini.
author | Jan Djärv <jan.h.d@swipnet.se> |
---|---|
date | Sat, 18 Nov 2006 14:46:40 +0000 |
parents | 51459eadddf2 |
children | f2f6a4b1bf80 dbe3f29e61d6 |
comparison
equal
deleted
inserted
replaced
74043:2bd7a6d6a83f | 74044:fd7d868143e8 |
---|---|
6 @appendix X Options and Resources | 6 @appendix X Options and Resources |
7 | 7 |
8 You can customize some X-related aspects of Emacs behavior using X | 8 You can customize some X-related aspects of Emacs behavior using X |
9 resources, as is usual for programs that use X. On MS-Windows, you | 9 resources, as is usual for programs that use X. On MS-Windows, you |
10 can customize some of the same aspects using the system registry. | 10 can customize some of the same aspects using the system registry. |
11 @xref{MS-Windows Registry}. Likewise, the Mac Carbon port emulates X | 11 @xref{MS-Windows Registry}. Likewise, Emacs on MacOS Carbon emulates X |
12 resources using the Preferences system. @xref{Mac Environment Variables}. | 12 resources using the Preferences system. @xref{Mac Environment Variables}. |
13 | 13 |
14 When Emacs is built using an `X toolkit', such as Lucid or LessTif, | 14 When Emacs is built using an ``X toolkit'', such as Lucid or |
15 you need to use X resources to customize the appearance of the | 15 LessTif, you need to use X resources to customize the appearance of |
16 widgets, including the menu-bar, scroll-bar, and dialog boxes. This | 16 the widgets, including the menu-bar, scroll-bar, and dialog boxes. |
17 is because the libraries that implement these don't provide for | 17 This is because the libraries that implement these don't provide for |
18 customization through Emacs. GTK+ widgets use a separate system of | 18 customization through Emacs. GTK+ widgets use a separate system of |
19 `GTK resources', which we will also describe. | 19 @ifnottex |
20 ``GTK resources'', which we will also describe. | |
21 @end ifnottex | |
22 @iftex | |
23 ``GTK resources.'' In this chapter we describe the most commonly used | |
24 resource specifications. For full documentation, see the online | |
25 manual. | |
26 | |
27 @c Add xref for LessTif/Motif menu resources. | |
28 @end iftex | |
29 | |
20 | 30 |
21 @menu | 31 @menu |
22 * Resources:: Using X resources with Emacs (in general). | 32 * Resources:: Using X resources with Emacs (in general). |
23 * Table of Resources:: Table of specific X resources that affect Emacs. | 33 * Table of Resources:: Table of specific X resources that affect Emacs. |
24 * Face Resources:: X resources for customizing faces. | 34 * Face Resources:: X resources for customizing faces. |
55 The menu and scrollbars are native widgets on MS-Windows, so they are | 65 The menu and scrollbars are native widgets on MS-Windows, so they are |
56 only customizable via the system-wide settings in the Display Control | 66 only customizable via the system-wide settings in the Display Control |
57 Panel. You can also set resources using the @samp{-xrm} command line | 67 Panel. You can also set resources using the @samp{-xrm} command line |
58 option (see below.) | 68 option (see below.) |
59 | 69 |
70 @iftex | |
71 Applications such as Emacs look for resources with specific names | |
72 and their particular meanings. Case distinctions are significant in | |
73 these names. Each resource specification in @file{~/.Xdefaults} | |
74 states the name of the program and the name of the resource. For | |
75 Emacs, the program name is @samp{Emacs}. It looks like this: | |
76 | |
77 @example | |
78 Emacs.borderWidth: 2 | |
79 @end example | |
80 @end iftex | |
81 @ifnottex | |
60 Programs define named resources with particular meanings. They also | 82 Programs define named resources with particular meanings. They also |
61 define how to group resources into named classes. For instance, in | 83 define how to group resources into named classes. For instance, in |
62 Emacs, the @samp{internalBorder} resource controls the width of the | 84 Emacs, the @samp{internalBorder} resource controls the width of the |
63 internal border, and the @samp{borderWidth} resource controls the width | 85 internal border, and the @samp{borderWidth} resource controls the width |
64 of the external border. Both of these resources are part of the | 86 of the external border. Both of these resources are part of the |
93 | 115 |
94 @example | 116 @example |
95 emacs.BorderWidth: 2 | 117 emacs.BorderWidth: 2 |
96 emacs.borderWidth: 4 | 118 emacs.borderWidth: 4 |
97 @end example | 119 @end example |
120 @end ifnottex | |
98 | 121 |
99 The order in which the lines appear in the file does not matter. | 122 The order in which the lines appear in the file does not matter. |
100 Also, command-line options always override the X resources file. | 123 Also, command-line options always override the X resources file. |
124 | |
125 @ifnottex | |
101 Here is a list of X command-line options and their corresponding | 126 Here is a list of X command-line options and their corresponding |
102 resource names. | 127 resource names. |
103 | 128 |
104 @table @samp | 129 @table @samp |
105 @item -name @var{name} | 130 @item -name @var{name} |
143 of resource specifications. Resource values specified with @samp{-xrm} | 168 of resource specifications. Resource values specified with @samp{-xrm} |
144 take precedence over all other resource specifications. | 169 take precedence over all other resource specifications. |
145 | 170 |
146 One way to experiment with the effect of different resource settings | 171 One way to experiment with the effect of different resource settings |
147 is to use the @code{editres} program. Select @samp{Get Tree} from the | 172 is to use the @code{editres} program. Select @samp{Get Tree} from the |
173 @end ifnottex | |
174 @iftex | |
175 You can experiment with the effect of different resource settings | |
176 with the @code{editres} program. Select @samp{Get Tree} from the | |
177 @end iftex | |
148 @samp{Commands} menu, then click on an Emacs frame. This will display | 178 @samp{Commands} menu, then click on an Emacs frame. This will display |
149 a tree showing the structure of X toolkit widgets used in an Emacs | 179 a tree showing the structure of X toolkit widgets used in an Emacs |
150 frame. Select one of them, such as @samp{menubar}, then select | 180 frame. Select one of them, such as @samp{menubar}, then select |
151 @samp{Show Resource Box} from the @samp{Commands} menu. This displays | 181 @samp{Show Resource Box} from the @samp{Commands} menu. This displays |
152 a list of all the meaningful X resources and allows you to edit them. | 182 a list of all the meaningful X resources for that widget, and allows |
153 Changes take effect immediately if you click on the @samp{Apply} button. | 183 you to edit them. Changes take effect when you click on the |
154 (See the @code{editres} man page for more details.) | 184 @samp{Apply} button. (See the @code{editres} man page for more |
185 details.) | |
155 | 186 |
156 @node Table of Resources | 187 @node Table of Resources |
157 @appendixsec Table of X Resources for Emacs | 188 @appendixsec Table of X Resources for Emacs |
158 | 189 |
159 This table lists the resource names that designate options for | 190 This table lists the resource names that designate options for |
162 | 193 |
163 @table @asis | 194 @table @asis |
164 @item @code{background} (class @code{Background}) | 195 @item @code{background} (class @code{Background}) |
165 Background color name. | 196 Background color name. |
166 | 197 |
198 @ifnottex | |
167 @item @code{bitmapIcon} (class @code{BitmapIcon}) | 199 @item @code{bitmapIcon} (class @code{BitmapIcon}) |
168 Use a bitmap icon (a picture of a gnu) if @samp{on}, let the window | 200 Use a bitmap icon (a picture of a gnu) if @samp{on}, let the window |
169 manager choose an icon if @samp{off}. | 201 manager choose an icon if @samp{off}. |
202 @end ifnottex | |
170 | 203 |
171 @item @code{borderColor} (class @code{BorderColor}) | 204 @item @code{borderColor} (class @code{BorderColor}) |
172 Color name for the external border. | 205 Color name for the external border. |
173 | 206 |
207 @ifnottex | |
174 @item @code{borderWidth} (class @code{BorderWidth}) | 208 @item @code{borderWidth} (class @code{BorderWidth}) |
175 Width in pixels of the external border. | 209 Width in pixels of the external border. |
210 @end ifnottex | |
176 | 211 |
177 @item @code{cursorColor} (class @code{Foreground}) | 212 @item @code{cursorColor} (class @code{Foreground}) |
178 Color name for text cursor (point). | 213 Color name for text cursor (point). |
179 | 214 |
215 @ifnottex | |
180 @item @code{cursorBlink} (class @code{CursorBlink}) | 216 @item @code{cursorBlink} (class @code{CursorBlink}) |
181 Specifies whether to make the cursor blink. The default is @samp{on}. Use | 217 Specifies whether to make the cursor blink. The default is @samp{on}. Use |
182 @samp{off} or @samp{false} to turn cursor blinking off. | 218 @samp{off} or @samp{false} to turn cursor blinking off. |
219 @end ifnottex | |
183 | 220 |
184 @item @code{font} (class @code{Font}) | 221 @item @code{font} (class @code{Font}) |
185 Font name for text (or fontset name, @pxref{Fontsets}). | 222 Font name (or fontset name, @pxref{Fontsets}) for @code{default} font. |
186 | 223 |
187 @item @code{foreground} (class @code{Foreground}) | 224 @item @code{foreground} (class @code{Foreground}) |
188 Color name for text. | 225 Color name for text. |
189 | 226 |
190 @item @code{geometry} (class @code{Geometry}) | 227 @item @code{geometry} (class @code{Geometry}) |
195 If this resource specifies a position, that position applies only to the | 232 If this resource specifies a position, that position applies only to the |
196 initial Emacs frame (or, in the case of a resource for a specific frame | 233 initial Emacs frame (or, in the case of a resource for a specific frame |
197 name, only that frame). However, the size, if specified here, applies to | 234 name, only that frame). However, the size, if specified here, applies to |
198 all frames. | 235 all frames. |
199 | 236 |
237 @ifnottex | |
200 @item @code{fullscreen} (class @code{Fullscreen}) | 238 @item @code{fullscreen} (class @code{Fullscreen}) |
201 The desired fullscreen size. The value can be one of @code{fullboth}, | 239 The desired fullscreen size. The value can be one of @code{fullboth}, |
202 @code{fullwidth} or @code{fullheight}, which correspond to | 240 @code{fullwidth} or @code{fullheight}, which correspond to |
203 the command-line options @samp{-fs}, @samp{-fw}, and @samp{-fh} | 241 the command-line options @samp{-fs}, @samp{-fw}, and @samp{-fh} |
204 (@pxref{Window Size X}). | 242 (@pxref{Window Size X}). |
205 | 243 |
206 Note that this applies to all frames created, not just the initial | 244 Note that this applies to the initial frame only. |
207 one. | 245 @end ifnottex |
208 | 246 |
209 @item @code{iconName} (class @code{Title}) | 247 @item @code{iconName} (class @code{Title}) |
210 Name to display in the icon. | 248 Name to display in the icon. |
211 | 249 |
212 @item @code{internalBorder} (class @code{BorderWidth}) | 250 @item @code{internalBorder} (class @code{BorderWidth}) |
217 @cindex leading | 255 @cindex leading |
218 Additional space (@dfn{leading}) between lines, in pixels. | 256 Additional space (@dfn{leading}) between lines, in pixels. |
219 | 257 |
220 @item @code{menuBar} (class @code{MenuBar}) | 258 @item @code{menuBar} (class @code{MenuBar}) |
221 @cindex menu bar | 259 @cindex menu bar |
222 Give frames menu bars if @samp{on}; don't have menu bars if | 260 Give frames menu bars if @samp{on}; don't have menu bars if @samp{off}. |
223 @samp{off}. @xref{Lucid Resources}, and @ref{LessTif Resources}, for | 261 @ifnottex |
224 how to control the appearance of the menu bar if you have one. | 262 @xref{Lucid Resources}, and @ref{LessTif Resources}, |
225 | 263 @end ifnottex |
264 @iftex | |
265 @xref{Lucid Resources}, | |
266 @end iftex | |
267 for how to control the appearance of the menu bar if you have one. | |
268 | |
269 @ifnottex | |
226 @item @code{minibuffer} (class @code{Minibuffer}) | 270 @item @code{minibuffer} (class @code{Minibuffer}) |
227 If @samp{none}, don't make a minibuffer in this frame. | 271 If @samp{none}, don't make a minibuffer in this frame. |
228 It will use a separate minibuffer frame instead. | 272 It will use a separate minibuffer frame instead. |
229 | 273 |
230 @item @code{paneFont} (class @code{Font}) | 274 @item @code{paneFont} (class @code{Font}) |
231 @cindex font for menus | 275 @cindex font for menus |
232 Font name for menu pane titles, in non-toolkit versions of Emacs. | 276 Font name for menu pane titles, in non-toolkit versions of Emacs. |
277 @end ifnottex | |
233 | 278 |
234 @item @code{pointerColor} (class @code{Foreground}) | 279 @item @code{pointerColor} (class @code{Foreground}) |
235 Color of the mouse cursor. | 280 Color of the mouse cursor. |
236 | 281 |
282 @ifnottex | |
237 @item @code{privateColormap} (class @code{PrivateColormap}) | 283 @item @code{privateColormap} (class @code{PrivateColormap}) |
238 If @samp{on}, use a private color map, in the case where the ``default | 284 If @samp{on}, use a private color map, in the case where the ``default |
239 visual'' of class PseudoColor and Emacs is using it. | 285 visual'' of class PseudoColor and Emacs is using it. |
240 | 286 |
241 @item @code{reverseVideo} (class @code{ReverseVideo}) | 287 @item @code{reverseVideo} (class @code{ReverseVideo}) |
242 Switch foreground and background default colors if @samp{on}, use colors as | 288 Switch foreground and background default colors if @samp{on}, use colors as |
243 specified if @samp{off}. | 289 specified if @samp{off}. |
290 @end ifnottex | |
244 | 291 |
245 @item @code{screenGamma} (class @code{ScreenGamma}) | 292 @item @code{screenGamma} (class @code{ScreenGamma}) |
246 @cindex gamma correction | 293 @cindex gamma correction |
247 Gamma correction for colors, equivalent to the frame parameter | 294 Gamma correction for colors, equivalent to the frame parameter |
248 @code{screen-gamma}. | 295 @code{screen-gamma}. |
249 | 296 |
297 @ifnottex | |
250 @item @code{selectionFont} (class @code{SelectionFont}) | 298 @item @code{selectionFont} (class @code{SelectionFont}) |
251 Font name for pop-up menu items, in non-toolkit versions of Emacs. (For | 299 Font name for pop-up menu items, in non-toolkit versions of Emacs. (For |
252 toolkit versions, see @ref{Lucid Resources}, also see @ref{LessTif | 300 toolkit versions, see @ref{Lucid Resources}, also see @ref{LessTif |
253 Resources}.) | 301 Resources}.) |
254 | 302 |
260 @item @code{synchronous} (class @code{Synchronous}) | 308 @item @code{synchronous} (class @code{Synchronous}) |
261 @cindex debugging X problems | 309 @cindex debugging X problems |
262 @cindex synchronous X mode | 310 @cindex synchronous X mode |
263 Run Emacs in synchronous mode if @samp{on}. Synchronous mode is | 311 Run Emacs in synchronous mode if @samp{on}. Synchronous mode is |
264 useful for debugging X problems. | 312 useful for debugging X problems. |
313 @end ifnottex | |
265 | 314 |
266 @item @code{title} (class @code{Title}) | 315 @item @code{title} (class @code{Title}) |
267 Name to display in the title bar of the initial Emacs frame. | 316 Name to display in the title bar of the initial Emacs frame. |
268 | 317 |
269 @item @code{toolBar} (class @code{ToolBar}) | 318 @item @code{toolBar} (class @code{ToolBar}) |
284 | 333 |
285 @item @code{verticalScrollBars} (class @code{ScrollBars}) | 334 @item @code{verticalScrollBars} (class @code{ScrollBars}) |
286 Give frames scroll bars if @samp{on}; don't have scroll bars if | 335 Give frames scroll bars if @samp{on}; don't have scroll bars if |
287 @samp{off}. | 336 @samp{off}. |
288 | 337 |
338 @ifnottex | |
289 @item @code{visualClass} (class @code{VisualClass}) | 339 @item @code{visualClass} (class @code{VisualClass}) |
290 Specify the ``visual'' that X should use. This tells X how to handle | 340 Specify the ``visual'' that X should use. This tells X how to handle |
291 colors. | 341 colors. |
292 | 342 |
293 The value should start with one of @samp{TrueColor}, | 343 The value should start with one of @samp{TrueColor}, |
294 @samp{PseudoColor}, @samp{DirectColor}, @samp{StaticColor}, | 344 @samp{PseudoColor}, @samp{DirectColor}, @samp{StaticColor}, |
295 @samp{GrayScale}, and @samp{StaticGray}, followed by | 345 @samp{GrayScale}, and @samp{StaticGray}, followed by |
296 @samp{-@var{depth}}, where @var{depth} is the number of color planes. | 346 @samp{-@var{depth}}, where @var{depth} is the number of color planes. |
297 Most terminals only allow a few ``visuals,'' and the @samp{dpyinfo} | 347 Most terminals only allow a few ``visuals,'' and the @samp{dpyinfo} |
298 program outputs information saying which ones. | 348 program outputs information saying which ones. |
349 @end ifnottex | |
299 @end table | 350 @end table |
300 | 351 |
301 @node Face Resources | 352 @node Face Resources |
302 @appendixsec X Resources for Faces | 353 @appendixsec X Resources for Faces |
303 | 354 |
356 @node Lucid Resources | 407 @node Lucid Resources |
357 @appendixsec Lucid Menu X Resources | 408 @appendixsec Lucid Menu X Resources |
358 @cindex Menu X Resources (Lucid widgets) | 409 @cindex Menu X Resources (Lucid widgets) |
359 @cindex Lucid Widget X Resources | 410 @cindex Lucid Widget X Resources |
360 | 411 |
412 @ifnottex | |
361 If the Emacs installed at your site was built to use the X toolkit | 413 If the Emacs installed at your site was built to use the X toolkit |
362 with the Lucid menu widgets, then the menu bar is a separate widget and | 414 with the Lucid menu widgets, then the menu bar is a separate widget and |
363 has its own resources. The resource names contain @samp{pane.menubar} | 415 has its own resources. The resource names contain @samp{pane.menubar} |
364 (following, as always, the name of the Emacs invocation, or @samp{Emacs}, | 416 (following, as always, the name of the Emacs invocation, or @samp{Emacs}, |
365 which stands for all Emacs invocations). Specify them like this: | 417 which stands for all Emacs invocations). Specify them like this: |
369 @end example | 421 @end example |
370 | 422 |
371 @noindent | 423 @noindent |
372 For example, to specify the font @samp{8x16} for the menu-bar items, | 424 For example, to specify the font @samp{8x16} for the menu-bar items, |
373 write this: | 425 write this: |
426 @end ifnottex | |
427 @iftex | |
428 If the Emacs installed at your site was built to use the X toolkit | |
429 with the Lucid menu widgets, then the menu bar is a separate widget | |
430 and has its own resources. The resource specifications start with | |
431 @samp{Emacs.pane.menubar}---for instance, to specify the font | |
432 @samp{8x16} for the menu-bar items, write this: | |
433 @end iftex | |
374 | 434 |
375 @example | 435 @example |
376 Emacs.pane.menubar.font: 8x16 | 436 Emacs.pane.menubar.font: 8x16 |
377 @end example | 437 @end example |
378 | 438 |
379 @noindent | 439 @noindent |
380 Resources for @emph{non-menubar} toolkit pop-up menus have | 440 Resources for @emph{non-menubar} toolkit pop-up menus have |
381 @samp{menu*}, in like fashion. For example, to specify the font | 441 @samp{menu*} instead of @samp{pane.menubar}. For example, to specify |
382 @samp{8x16} for the pop-up menu items, write this: | 442 the font @samp{8x16} for the pop-up menu items, write this: |
383 | 443 |
384 @example | 444 @example |
385 Emacs.menu*.font: 8x16 | 445 Emacs.menu*.font: 8x16 |
386 @end example | 446 @end example |
387 | 447 |
388 @noindent | 448 @noindent |
389 For dialog boxes, use @samp{dialog} instead of @samp{menu}: | 449 For dialog boxes, use @samp{dialog*}: |
390 | 450 |
391 @example | 451 @example |
392 Emacs.dialog*.font: 8x16 | 452 Emacs.dialog*.font: 8x16 |
393 @end example | 453 @end example |
394 | 454 |
395 @noindent | 455 @noindent |
396 The Lucid menus can display multilingual text in your locale. For more | 456 The Lucid menus can display multilingual text in your locale. For |
397 information about fontsets see the man page for XCreateFontSet. To enable | 457 more information about fontsets see the man page for |
398 multilingual menu text you specify a fontSet resource instead of the font | 458 @code{XCreateFontSet}. To enable multilingual menu text you specify a |
399 resource. If both font and fontSet resources are specified, the fontSet | 459 @code{fontSet} resource instead of the font resource. If both |
400 resource is used. To specify | 460 @code{font} and @code{fontSet} resources are specified, the |
401 @samp{-*-helvetica-medium-r-*--*-120-*-*-*-*-*-*,*} for both the popup and | 461 @code{fontSet} resource is used. |
402 menu bar menus, write this: | 462 |
463 Thus, to specify @samp{-*-helvetica-medium-r-*--*-120-*-*-*-*-*-*,*} | |
464 for both the popup and menu bar menus, write this: | |
403 | 465 |
404 @example | 466 @example |
405 Emacs*fontSet: -*-helvetica-medium-r-*--*-120-*-*-*-*-*-*,* | 467 Emacs*menu*fontSet: -*-helvetica-medium-r-*--*-120-*-*-*-*-*-*,* |
406 @end example | 468 @end example |
407 | 469 |
408 @noindent | 470 @noindent |
471 The @samp{*menu*} as a wildcard matches @samp{pane.menubar} and | |
472 @samp{menu@dots{}}. | |
473 | |
409 Experience shows that on some systems you may need to add | 474 Experience shows that on some systems you may need to add |
410 @samp{shell.}@: before the @samp{pane.menubar} or @samp{menu*}. On | 475 @samp{shell.}@: before the @samp{pane.menubar} or @samp{menu*}. On |
411 some other systems, you must not add @samp{shell.}. | 476 some other systems, you must not add @samp{shell.}. The generic wildcard |
477 approach should work on both kinds of systems. | |
412 | 478 |
413 Here is a list of the specific resources for menu bars and pop-up menus: | 479 Here is a list of the specific resources for menu bars and pop-up menus: |
414 | 480 |
415 @table @code | 481 @table @code |
416 @item font | 482 @item font |
421 Color of the foreground. | 487 Color of the foreground. |
422 @item background | 488 @item background |
423 Color of the background. | 489 Color of the background. |
424 @item buttonForeground | 490 @item buttonForeground |
425 In the menu bar, the color of the foreground for a selected item. | 491 In the menu bar, the color of the foreground for a selected item. |
492 @ifnottex | |
426 @item horizontalSpacing | 493 @item horizontalSpacing |
427 Horizontal spacing in pixels between items. Default is 3. | 494 Horizontal spacing in pixels between items. Default is 3. |
428 @item verticalSpacing | 495 @item verticalSpacing |
429 Vertical spacing in pixels between items. Default is 2. | 496 Vertical spacing in pixels between items. Default is 2. |
430 @item arrowSpacing | 497 @item arrowSpacing |
438 the arrows in the menus do not stand out clearly enough or that the | 505 the arrows in the menus do not stand out clearly enough or that the |
439 difference between ``in'' and ``out'' buttons is difficult to see, set | 506 difference between ``in'' and ``out'' buttons is difficult to see, set |
440 this to 2. If you have no problems with visibility, the default | 507 this to 2. If you have no problems with visibility, the default |
441 probably looks better. The background color may also have some effect | 508 probably looks better. The background color may also have some effect |
442 on the contrast. | 509 on the contrast. |
510 @end ifnottex | |
443 @item margin | 511 @item margin |
444 The margin of the menu bar, in characters. Default is 1. | 512 The margin of the menu bar, in characters. Default is 1. |
445 @end table | 513 @end table |
446 | 514 |
515 @ifnottex | |
447 @node LessTif Resources | 516 @node LessTif Resources |
448 @appendixsec LessTif Menu X Resources | 517 @appendixsec LessTif Menu X Resources |
449 @cindex Menu X Resources (LessTif widgets) | 518 @cindex Menu X Resources (LessTif widgets) |
450 @cindex LessTif Widget X Resources | 519 @cindex LessTif Widget X Resources |
451 | 520 |
574 @item bottomShadowColor | 643 @item bottomShadowColor |
575 The color for the border shadow, on the bottom and the right. | 644 The color for the border shadow, on the bottom and the right. |
576 @item topShadowColor | 645 @item topShadowColor |
577 The color for the border shadow, on the top and the left. | 646 The color for the border shadow, on the top and the left. |
578 @end table | 647 @end table |
648 @end ifnottex | |
579 | 649 |
580 | 650 |
581 @node GTK resources | 651 @node GTK resources |
582 @appendixsec GTK resources | 652 @appendixsec GTK resources |
653 @iftex | |
654 The most common way to customize the GTK widgets Emacs uses (menus, dialogs | |
655 tool bars and scroll bars) is by choosing an appropriate theme, for example | |
656 with the GNOME theme selector. You can also do Emacs specific customization | |
657 by inserting GTK style directives in the file @file{~/.emacs.d/gtkrc}. Some GTK | |
658 themes ignore customizations in @file{~/.emacs.d/gtkrc} so not everything | |
659 works with all themes. To customize Emacs font, background, faces, etc., use | |
660 the normal X resources (@pxref{Resources}). We will present some examples of | |
661 customizations here, but for a more detailed description, see the online manual | |
662 | |
663 The first example is just one line. It changes the font on all GTK widgets | |
664 to courier with size 12: | |
665 | |
666 @smallexample | |
667 gtk-font-name = "courier 12" | |
668 @end smallexample | |
669 | |
670 The thing to note is that the font name is not an X font name, like | |
671 -*-helvetica-medium-r-*--*-120-*-*-*-*-*-*, but a Pango font name. A Pango | |
672 font name is basically of the format "family style size", where the style | |
673 is optional as in the case above. A name with a style could be for example: | |
674 | |
675 @smallexample | |
676 gtk-font-name = "helvetica bold 10" | |
677 @end smallexample | |
678 | |
679 To customize widgets you first define a style and then apply the style to | |
680 the widgets. Here is an example that sets the font for menus, but not | |
681 for other widgets: | |
682 | |
683 @smallexample | |
684 # @r{Define the style @samp{menufont}.} | |
685 style "menufont" | |
686 @{ | |
687 font_name = "helvetica bold 14" # This is a Pango font name | |
688 @} | |
689 | |
690 # @r{Specify that widget type @samp{*emacs-menuitem*} uses @samp{menufont}.} | |
691 widget "*emacs-menuitem*" style "menufont" | |
692 @end smallexample | |
693 | |
694 The widget name in this example contains wildcards, so the style will be | |
695 applied to all widgets that match "*emacs-menuitem*". The widgets are | |
696 named by the way they are contained, from the outer widget to the inner widget. | |
697 So to apply the style "my_style" (not shown) with the full, absolute name, for | |
698 the menubar and the scroll bar in Emacs we use: | |
699 | |
700 @smallexample | |
701 widget "Emacs.pane.menubar" style "my_style" | |
702 widget "Emacs.pane.emacs.verticalScrollBar" style "my_style" | |
703 @end smallexample | |
704 | |
705 But to avoid having to type it all, wildcards are often used. @samp{*} | |
706 matches zero or more characters and @samp{?} matches one character. So "*" | |
707 matches all widgets. | |
708 | |
709 Each widget has a class (for example GtkMenuItem) and a name (emacs-menuitem). | |
710 You can assign styles by name or by class. In this example we have used the | |
711 class: | |
712 | |
713 @smallexample | |
714 style "menufont" | |
715 @{ | |
716 font_name = "helvetica bold 14" | |
717 @} | |
718 | |
719 widget_class "*GtkMenuBar" style "menufont" | |
720 @end smallexample | |
721 | |
722 @noindent | |
723 The names and classes for the GTK widgets Emacs uses are: | |
724 | |
725 @multitable {@code{verticalScrollbar plus}} {@code{GtkFileSelection} and some} | |
726 @item @code{emacs-filedialog} | |
727 @tab @code{GtkFileSelection} | |
728 @item @code{emacs-dialog} | |
729 @tab @code{GtkDialog} | |
730 @item @code{Emacs} | |
731 @tab @code{GtkWindow} | |
732 @item @code{pane} | |
733 @tab @code{GtkVHbox} | |
734 @item @code{emacs} | |
735 @tab @code{GtkFixed} | |
736 @item @code{verticalScrollBar} | |
737 @tab @code{GtkVScrollbar} | |
738 @item @code{emacs-toolbar} | |
739 @tab @code{GtkToolbar} | |
740 @item @code{menubar} | |
741 @tab @code{GtkMenuBar} | |
742 @item @code{emacs-menuitem} | |
743 @tab anything in menus | |
744 @end multitable | |
745 | |
746 GTK absolute names are quite strange when it comes to menus | |
747 and dialogs. The names do not start with @samp{Emacs}, as they are | |
748 free-standing windows and not contained (in the GTK sense) by the | |
749 Emacs GtkWindow. To customize the dialogs and menus, use wildcards like this: | |
750 | |
751 @smallexample | |
752 widget "*emacs-dialog*" style "my_dialog_style" | |
753 widget "*emacs-filedialog* style "my_file_style" | |
754 widget "*emacs-menuitem* style "my_menu_style" | |
755 @end smallexample | |
756 | |
757 If you specify a customization in @file{~/.emacs.d/gtkrc}, then it | |
758 automatically applies only to Emacs, since other programs don't read | |
759 that file. For example, the drop down menu in the file dialog can not | |
760 be customized by any absolute widget name, only by an absolute class | |
761 name. This is because the widgets in the drop down menu do not | |
762 have names and the menu is not contained in the Emacs GtkWindow. To | |
763 have all menus in Emacs look the same, use this in | |
764 @file{~/.emacs.d/gtkrc}: | |
765 | |
766 @smallexample | |
767 widget_class "*Menu*" style "my_menu_style" | |
768 @end smallexample | |
769 | |
770 Here is a more elaborate example, showing how to change the parts of | |
771 the scroll bar: | |
772 | |
773 @smallexample | |
774 style "scroll" | |
775 @{ | |
776 fg[NORMAL] = "red"@ @ @ @ @ # @r{The arrow color.} | |
777 bg[NORMAL] = "yellow"@ @ # @r{The thumb and background around the arrow.} | |
778 bg[ACTIVE] = "blue"@ @ @ @ # @r{The trough color.} | |
779 bg[PRELIGHT] = "white"@ # @r{The thumb color when the mouse is over it.} | |
780 @} | |
781 | |
782 widget "*verticalScrollBar*" style "scroll" | |
783 @end smallexample | |
784 @end iftex | |
785 | |
786 @ifnottex | |
583 @cindex GTK resources and customization | 787 @cindex GTK resources and customization |
584 @cindex resource files for GTK | 788 @cindex resource files for GTK |
585 @cindex @file{~/.gtkrc-2.0} file | 789 @cindex @file{~/.gtkrc-2.0} file |
586 @cindex @file{~/.emacs.d/gtkrc} file | 790 @cindex @file{~/.emacs.d/gtkrc} file |
587 | 791 |
994 @code{semi-condensed}, @code{normal}, @code{semi-expanded}, | 1198 @code{semi-condensed}, @code{normal}, @code{semi-expanded}, |
995 @code{expanded}, @code{extra-expanded}, or @code{ultra-expanded}. | 1199 @code{expanded}, @code{extra-expanded}, or @code{ultra-expanded}. |
996 | 1200 |
997 @noindent | 1201 @noindent |
998 @var{size} is a decimal number that describes the font size in points. | 1202 @var{size} is a decimal number that describes the font size in points. |
1203 @end ifnottex | |
999 | 1204 |
1000 @ignore | 1205 @ignore |
1001 arch-tag: 9b6ff773-48b6-41f6-b2f9-f114b8bdd97f | 1206 arch-tag: 9b6ff773-48b6-41f6-b2f9-f114b8bdd97f |
1002 @end ignore | 1207 @end ignore |