You are currently viewing a snapshot of www.mozilla.org taken on April 21, 2008. Most of this content is highly out of date (some pages haven't been updated since the project began in 1998) and exists for historical purposes only. If there are any pages on this archive site that you think should be added back to www.mozilla.org, please file a bug.



Customizing Mozilla

The purpose of this document is to offer some hints about some of the less well documented features in Mozilla which can be customized to suit the user's preference.

Nearly all of these techniques are cross-platform. Don't be confused by the url where this document lives in the mozilla.org document tree.

Here are some of the topics covered in this document:

Other ways of customizing Mozilla include Configurable Security Policies.

Some related documents are:


User CSS (changing fonts, colors and other style)

Much of Mozilla's fonts and colors are controlled via CSS (Cascading Style Sheets).

These are set in .css files in Mozilla's chrome directories, but the user can override them with two plain text files, called userContent.css and userChrome.css. Neither userChrome.css nor userContent.css exist by default. If you want them, you create them in the chrome subdirectory underneath the user's profile directory. userChrome.css controls CSS for the UI chrome of the Mozilla application; userContent.css controls CSS for content inside windows.

userChrome.css

Here are some samples of things you can change via userChrome.css:


/* Set font size and family for dialogs
 * and other miscellaneous text
 */
window {
  font-size: 3.5mm !important;
  font-family: helvetica !important;
}

/* Place the sidebar on the right edge of the window
   Side effect: also moves the mail folder to the right side 
(Bug 226926)

 */
window > hbox {
  direction:rtl;
}
window > hbox > * {
  direction:ltr;
}

/* PERSONAL TOOLBAR */
/*
 * Note: Rules affecting icons on the PT do not apply to folder contents.
 * Those are governed by "Bookmarks menu" rules.
 */

/* Kill bookmark icons in the Personal Toolbar */
toolbarbutton.bookmark-item > .toolbarbutton-icon {
  display: none;
}

/* Alternatives: */
/* Select only bookmark folder icons */
/*
.bookmark-item[type="menu"] > .toolbarbutton-icon {
  do something...
}
 */

/* Select only tab group icons */
/*
.bookmark-item.bookmark-group > .toolbarbutton-icon {
  do something...
}
 */

/* Example: only kill icons on normal bookmarks */
/*
.bookmark-item:not(.bookmark-group):not([type="menu"]) > .toolbarbutton-icon {
  display: none;
}
 */

/* Visual aids for no-icons operation */

/* Make tab group bookmarks italic and brown */
.bookmark-group > .toolbarbutton-text {
   font-style: italic;
   color: brown;
}

/* Make bookmark folders bold and navy blue */
.bookmark-item[type="menu"] > .toolbarbutton-text {
   font-weight: 900;
   color: navy;
}

/* BOOKMARKS MENU */

/* Kill "normal" bookmark icons in the bookmarks menu */
menuitem.bookmark-item > .menu-iconic-left {
  display: none;
}

/* Other examples: */

/* kill icons for bookmark folders in Bookmarks menu */
menu.bookmark-item > .menu-iconic-left {
  display: none;
}

/* kill icons for bookmark groups in Bookmarks menu */
menuitem.bookmark-group > .menu-iconic-left {
  display: none;
}

/* Style the now-iconless bookmark menu items (mimicking the PT styles) */
/* bookmark folders */
menu.bookmark-item {
  color: navy !important;
  font-weight: 900 !important;
}

/* tab group bookmarks */
menuitem.bookmark-group {
   color: brown !important;
   font-style: italic !important;
}

/* You could select normal bookmarks this way */
/*
menuitem.bookmark-item {
  do something...
}
*/

/* TABBROWSER TABS */

/* Kill tabbrowser icons */
/* Note: this leaves some empty vertical space in the tab strip in some themes */

/* Kill all tab icons, no matter what */
/*
.tabbrowser-tabs .tab-icon {
  display: none;
}
 */

/* Alternatively, kill only default tabbrowser icons (no site icon) */
.tabbrowser-tabs *|tab:not([image]) .tab-icon {
  display: none;
}

/* Show icons (no matter what) when hovering over the tab */
/*
.tabbrowser-tabs *|tab:hover .tab-icon {
  display: -moz-box;
}
 */

/* Show tab loading indicator while the tab is loading */
/*
.tabbrowser-tabs *|tab[busy] .tab-icon {
  display:-moz-box;
}
*/

/* Shrink tab titles by 10% */
.tabbrowser-tabs .tab-text {
  font-size: 90%;
}

/* Turn off the great big icons on editor/mail toolbars (bugs 78843/94581) */
.toolbar-primary-icon {
    visibility: collapse;
}

/* Make menus big, pretty and readable (like the old SGI look):
 * menubar isn't used after 12/19 builds, but is needed for NS6;
 * the rest are for post-12/19
 */
menubar, menubutton, menulist, menu, menuitem {
  font-family: helvetica !important;
  font-style: italic !important;
  font-weight: bold !important;
  font-size: 4mm !important;
}

/* Next two don't work as either "slider" or "scrollbar".
 * Apparently scrollbar size is controlled by images
 * used for the up/down/left/right arrows.
slider {
   height: 20px !important;
}
slider[align="vertical"] {
   width: 20px !important;
}
*/

/* Single line text fields */
input {
  /* Set font size and family of text fields */
  font-family: clean !important;
  font-size: 13px !important;

  /* Set background color to something a little prettier */
  background-color: rgb(200, 255, 220) !important;

  /* Add some key bindings.
   * For an explanation of how to do this,
   * see below under "Custom key bindings".
   */
  -moz-binding: url("resource:///res/builtin/myHTMLBindings.xml#myInputFields") !important;
}

/* Multi-line textareas */
textarea {
  background-color: rgb(200, 255, 220) !important;
}

/* The  dropdown address and autocomplete windows are grey.
 * To make them match better with the URL field and look more like 4.x:
 */

/*  URL dropdown box  */
#ubhist-popup
  {
    background            : white !important;
    border                : 1px solid black !important;
    padding               : 0px !important;            
  }

/*  autocomplete text field  */
.textfield-popup
  {
    background            : white !important;
    border                : 1px solid black !important;
  }

#ubhist-popup > .popup-internal-box, .textfield-popup > .popup-internal-box
  {
    border-left           : 1px solid white !important;
    border-top            : 1px solid white !important;
    border-right          : 1px solid white !important;
    border-bottom         : 1px solid white !important;
  }

/* 3. Add a border (line of 1px) to the tooltips. */
.tooltip-label
   {
     border                : 1px solid !important;
   }

/* MAIL
 *
 * For other things you can change in mail windows,
 * see the files in the source tree under themes/modern/messenger
 */

/* Specify the font used for the subject in the message pane
 * (it was bold, fixed-width and too wide).
 */
.subjectvalue {
  font-family; helvetica !important;
  font-weight: normal !important;
}

/* Make the thread and folder panes readable. */
treechildren {
  font-size: 14px !important;
}

/* Change the background colour of the messages (top right hand
 * pane in 3-pane view) of Mail/News from gray to white.
 */
outliner {
     background-color : white !important;
}

userContent.css

Here are some samples of things you can change via userContent.css:

/* Obviate need to zoom on many sites. */
html>body {
  font-size: 100% !important;
  line-height: normal !important;
}

/*
 * Disable the deprecated HTML <font> tag. (Like above,
 * reduces need to zoom.)
 */
font {
  font-family: inherit !important;
  font-size: inherit !important;
  color: inherit !important;
}

/* Put a thin black border around all dropdown forms like NS4.x */
:-moz-dropdown-list {
  border: 1px solid black !important;
  border-top-style: solid !important;
}

/* Disable marquee display */
marquee {
  -moz-binding: none; display: block; height: auto !important;
  /* This is better than just display:none !important;
   * because you can still see the text in the marquee,
   * but without scrolling.
   */
}

/*
 * Until bug 105547 is fixed, a helpful workaround to
 * highlight some links which would pop up a new window:
 */
:link:hover[target="_blank"],:visited:hover[target="_blank"] {
  color: white !important; background: red !important;
}
:link:hover[target="_new"],:visited:hover[target="_new"] {
  color: white !important; background: red !important;
}

/*
 * Many input forms have typing areas so small it's hard to use
 * them. On many of them, this sets a minimum width of about 50
 * characters, and a miniumum height of about 12 characters.
 */
textarea {
  min-width: 50ex !important;
  min-height: 12em !important;
}

/* Improve scroll performance on slow machines on some sites. */
* {
  background-attachment: scroll !important;
}

/*
 * Ignore user-specified style in mail messages.
 * See http://bugzilla.mozilla.org/show_bug.cgi?id=18427 for details.
 */
.moz-text-html font, .moz-text-html div, .moz-text-html body {
  font-size: inherit !important;
  font-family: inherit !important;
  color: inherit !important;
  background-color: inherit !important;
  background-image: inherit !important;
  text-align: inherit !important;
  text-indent: inherit !important;
}

/*
 * These are for chatzilla:
 */

/* defaults for anything in the chatzilla content area */
.output-window {
    background: #555 !important;
    color: white !important;
    font-weight: bold !important;

    /* for testing CSS syntax:
    border-style: solid;
    border-width: thick;
    border-color: #0f0 !important;
     */
}

/* messages I type */
.msg[msg-user$="ME!"] .msg-data {
    color: orange !important;
    background: #555 !important;
}

/* every other message can have a different color,
 * to make it easier to follow conversations
 */
.msg[mark="odd"] .msg-data {
    color: white !important;
    background: #666 !important;
}

/* messages directed to me */
.msg[important] .msg-data {
    color: yellow !important;
    /* background: gray !important; */
}

/* messages when people leave the channel */
.msg[msg-type="QUIT"] .msg-data {
    background: #444 !important;
    color: yellow !important;
}

Making fonts more readable on Linux

Various Linux distributions have problems with fonts; in particular, Arial, used in many web pages, may map to a font that looks blocky and is smaller than the requested size.

A full discussion is in bug 46415, but an easy solution for Redhat users is this:

If you find that pages which use "Arial" fonts are difficult to read -- for example, if this Arial text looks smaller or harder to read than the rest of the text in this paragraph -- try the following:

mv /usr/share/fonts/ISO8859-2 /usr/share/fonts.ISO8859-2

and then log out of X and log back in again.

You can always undo this, if necessary, with the command:

mv /usr/share/fonts.ISO8859-2 /usr/share/fonts/ISO8859-2

Mozilla DPI-related Font Size Issues on Unix explains how you may be able to improve fonts by adjusting your DPI.

It's also worth reading this excellent discussion on fuzzy Linux fonts.


Key Bindings

Some background theory on Mozilla key bindings

(I don't care about theory, just show me an example I can copy)

Modifier keys: The accel key

Mozilla, as a cross-platform application, has to deal with different modifier keys on different platforms. Windows uses the control key for most of its bindings (for example, ctrl-q quits the application); Mac uses command (cmd-q does what ctrl-q would do in Windows); Unix traditionally used the alt key because Unix apps have other bindings on control which conflict with Mozilla's window bindings, but some Linux users with a Windows background want to use control (control is the default, on the theory that people who prefer to use alt are mostly experienced users). So in Mozilla, the modifier key used for window bindings is called the accel key, and it's changeable.

The accel key is modified by a pair of preferences (see the preferences section for information on how to set hidden preferences). The key values are VK_CONTROL, VK_ALT, and VK_META, from nsIDOMKeyEvent.idl, but unfortunately the symbols don't work (yet) in prefs files, so you have to use the numbers, which are 17 for control, 18 for alt, 224 for meta (or command on Mac).

ui.key.accelKey
Integer: Sets the primary accelerator modifier key.
ui.key.menuAccessKey
Integer: Sets the menu access key.
ui.key.menuAccessKeyFocuses
Boolean: if set, pressing the menu access key will shift focus to the menu system and highlight the first menu (usually File). This causes problems on some Unix Window managers, and is off by default on Unix.
ui.key.generalAccessKey
Integer: sets the access key for use within web pages (see bug 128452 for some discussion).

For a more concrete example, Unix users can do this to switch accel to the alt key and turn off alt menu access (like Netscape 4.x):

user_pref("ui.key.accelKey", 18);
user_pref("ui.key.menuAccessKey", 0);

How Key Bindings Work in Mozilla

Key bindings in mozilla are handled through two mechanisms: XUL, and XBL. XUL bindings sometimes override XBL bindings. This is a known bug (bug 77976).

To create custom key bindings to XUL based commands, unzip the mozilla/chrome/comm.jar file, add or modify appropriate bindings, and zip up a new comm.jar file. (Watch bug 102993 for progress on making it easier to rebind XUL accelerators.) The rest of this section describes custom XBL bindings.

The default XBL bindings for Mozilla are in chrome files with names like "*Bindings.xml". In particular, bindings for text field and text areas, the browser window, and the editor window live in htmlBindings.xml. In addition, there are platform-specific bindings, which live in the file platformHTMLBindings.xml. These contain things like the emacs-inspired text editing keys on Unix, the different scroll handling on Windows, or the different binding for redo on the Mac.

Other files containing key bindings for other windows include treeBindings.xml, tabBindings.xml, and radioBindings.xml. I don't know where the bindings for the mail window are. I hope someone who knows sees this and updates this document.

In a normal Mozilla installation, the htmlBindings.xml and platformHTMLBindings.xml files are in the installation directory under res/builtin. You can look at them there, or modify those files in place to add new bindings of your own.

A typical set of key bindings looks like this (edited for brevity):

  <binding id="inputFieldsBase">
    <handlers>
    <!-- Copy, on accel-C -->
    <handler event="keypress" id="key_copy" key="c" modifiers="accel"
        command="cmd_copy"/>

    <!-- Left Arrow -->
    <handler event="keypress" id="key_left" keycode="VK_LEFT"
        command="cmd_charPrevious"/>

    </handlers>
  </binding>

This shows two types of key handlers. Both operate on the keypress event. (It's possible to have key handlers on keydown or keyup, but it's not generally recommended unless you know what you're doing.)

The first handler ties the command copy to accel-c. For keys representing printable ascii characters, use key= and the normal character. Accel is the primary modifier key on the current platform. By default, it's tied to control on Windows and Unix, command on Mac, but it's configurable (see above, Changing the accel key). Other allowable modifiers include control, alt, shift, and eventually will include meta (meta is not yet implemented on all platforms). Modifiers are comma-separated, e.g. modifiers="alt,shift".

The second handler uses a keycode symbol, used for unprintable/nonascii keys. The list of key symbols is in nsIDOMKeyEvent.idl (remove the DOM_VK_ prefix from the keycode name). You will notice that there are currently keycodes corresponding to many of the printable ascii characters; using them (e.g. keycode="VK_A") is strongly discouraged, and these symbols may go away in the future. The only reason to use these symbols is in order to define a binding on an event other than keypress (only keypress returns ascii key values), and there aren't any currently known reasons to do that.

Setting up custom key bindings: examples

Key bindings are set two different ways, depending on whether you are setting up bindings for an XBL widget (like text fields or textareas) or for a whole window (like the browser window or the composer window).

Custom key bindings in a mozilla window

userHTMLBindings.xml seems to be broken -- see bug 201011. The following section describes how it is supposed to work:
For editor and browser windows, create a file called userHTMLBindings.xml and link it into res/builtin wherever mozilla is installed on your machine. (Eventually we want this to live in the user's chrome directory, but that doesn't work yet; watch bug 12911 for progress on this. We recommend, for now, that you keep the real user bindings file in your chrome directory and make a symbolic link (=shortcut on Windows, alias on Mac) from there to res/builtin.)
Until bug 201011 is fixed, a workaround is to add or change individual key bindings by editing the file res/builtin/platformHTMLBindings.xml in your Mozilla installation directory.

Here's a sample userHTMLBindings.xml:

<?xml version="1.0"?>

<!-- In order to work correctly, this file must be named -->
<!-- res/builtin/userHTMLBindings.xml in the mozilla tree. -->

<bindings id="htmlBindings"
   xmlns="http://www.mozilla.org/xbl"
   xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

  <binding id="editorUser">
    <handlers>
      <handler event="keypress" key="w" modifiers="control"
       command="cmd_deleteWordBackward"/>
    </handlers>
  </binding>

  <binding id="browserUser">
    <handlers>
      <handler event="keypress" keycode="VK_BACK"
       command="cmd_scrollPageUp"/>
      <handler event="keypress" key="v" modifiers="alt"
       command="cmd_scrollPageUp"/>
      <handler event="keypress" key="v" modifiers="control"
       command="cmd_scrollPageDown"/>
    </handlers>
  </binding>

</bindings>

Custom key bindings in widgets

For widgets such as text fields and text areas, create a file called myHTMLBindings.xml file and put it in the directory res/builtin.

myHTMLBindings.xml might look something like this:

<?xml version="1.0"?>

<!-- In order to work correctly, this file must live in the -->
<!-- res/builtin directory of the mozilla tree. -->

<bindings id="htmlBindings"
   xmlns="http://www.mozilla.org/xbl"
   xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

  <binding id=myInputFields
   extends="resource:///res/builtin/platformHTMLBindings.xml#inputFields">
 
    <handlers>

    <handler event="keypress" key="g" modifiers="control" 
        command="cmd_deleteWordBackward"/>
    <!-- (or insert your favorite keybindings here) -->

    </handlers>
  </binding>

</bindings>

However, for widgets there's an extra step: myHTMLBindings isn't recognized automatically, so you also have to add a line to your user.css file (located in the chrome subdirectory of your profile directory; note that this means that custom bindings have to be set separately for each profile):

input {
  /* Add some key bindings. */
  -moz-binding: url("resource:///res/builtin/myHTMLBindings.xml#myInputFields") !important;
}

Legal commands for use in custom key bindings

What commands are legal in key bindings? You can use anything that's registered with a command handler in the window. Here are some of the commands available.

nsDomWindowController commands (generally legal when there is a selection):

  • cmd_copy
  • cmd_cut
  • cmd_paste
  • cmd_selectAll
  • cmd_selectNone
  • cmd_copyLink
  • cmd_copyImageLocation
  • cmd_copyImageContents
  • cmd_scrollTop
  • cmd_scrollBottom
  • cmd_scrollPageUp
  • cmd_scrollPageDown
  • cmd_scrollLineUp
  • cmd_scrollLineDown
  • cmd_scrollLeft
  • cmd_scrollRight
  • cmd_selectCharPrevious
  • cmd_selectCharNext
  • cmd_wordPrevious
  • cmd_wordNext
  • cmd_selectWordPrevious
  • cmd_selectWordNext
  • cmd_beginLine
  • cmd_endLine
  • cmd_selectBeginLine
  • cmd_selectEndLine
  • cmd_selectLinePrevious
  • cmd_selectLineNext
  • cmd_selectPagePrevious
  • cmd_selectPageNext
  • cmd_selectMoveTop
  • cmd_selectMoveBottom

Editor commands (legal when the focus is anywhere where you can type text):

  • cmd_paste
  • cmd_pasteQuote
  • cmd_delete
  • cmd_deleteCharBackward
  • cmd_deleteCharForward
  • cmd_deleteWordBackward
  • cmd_deleteWordForward
  • cmd_deleteToBeginningOfLine
  • cmd_deleteToEndOfLine
  • cmd_delete
  • cmd_deleteCharBackward
  • cmd_deleteCharForward
  • cmd_deleteWordBackward
  • cmd_deleteWordForward
  • cmd_deleteToBeginningOfLine
  • cmd_deleteToEndOfLine
  • cmd_scrollTop
  • cmd_scrollBottom
  • cmd_moveTop
  • cmd_moveBottom
  • cmd_selectTop
  • cmd_selectBottom
  • cmd_lineNext
  • cmd_linePrevious
  • cmd_selectLineNext
  • cmd_selectLinePrevious
  • cmd_charPrevious
  • cmd_charNext
  • cmd_selectCharPrevious
  • cmd_selectCharNext
  • cmd_beginLine
  • cmd_endLine
  • cmd_selectBeginLine
  • cmd_selectEndLine
  • cmd_wordPrevious
  • cmd_wordNext
  • cmd_selectWordPrevious
  • cmd_selectWordNext
  • cmd_scrollPageUp
  • cmd_scrollPageDown
  • cmd_scrollLineUp
  • cmd_scrollLineDown
  • cmd_movePageUp
  • cmd_movePageDown
  • cmd_selectPageUp
  • cmd_selectPageDown

Composer commands. (legal when the focus is in an html editor, such as Composer). Not listed here because they haven't been tested from XBL bindings, though in theory they should work.

Browser commands aren't defined in any centralized location. They are scattered over many files, including these (look for strings that start with "cmd_" or "Browser:"): linkToolbarOverlay.xul, navigator.js, navigatorOverlay.xul, personalToolbar.js, viewSourceOverlay.xul, contentAreaContextOverlay.xul, utilityOverlay.js, viewZoomOverlay.xul, platformCommunicatorOverlay.xul, bookmark.properties, bookmarks-temp.js, bookmarks.xml, bookmarksOverlay.xul, and bookmarksTree.js.

Mail/news commands are scattered over these files (again, look for strings beginning with "cmd_"): abCommon.js, addressbook.xul, commandglue.js, mail3PaneWindowCommands.js, mailABOverlay.xul, mailContextMenus.js, mailEditorOverlay.xul, mailNavigatorOverlay.xul, mailOverlay.xul, mailWindowOverlay.js, mailWindowOverlay.xul, messageWindow.js, messenger.xul, platformMailnewsOverlay.xul, SearchDialog.js, MsgComposeCommands.js, messengercompose.xul, and msgCompSMIMEOverlay.js.

If someone has time to go through the browser and mailnews commands and make an orderly list, it would be greatly appreciated and happily included in the next revision of this document.


Other Useful Preferences

First, a note: these prefs generally have no UI in the Preferences/Options dialog, and must be set differently.

UPDATE: In Mozilla 1.4 or later, it is possible to edit the preferences normally stored in user.js by using the UI displayed by entering about:config in the Location Bar; this feature didn't exist when most of this document was written. This is convenient for small edits, and takes effect immediately (no need to restart Mozilla). A menu option ([Tools]-[Advanced Preferences]) brings up a similar editor in thunderbird as well.

Normal prefs are kept in prefs.js in the user's profile directory (which is overwritten by Mozilla every time a pref is changed), but here's a tip: prefs or other JavaScript that you don't want overwritten (e.g. comments) can be put in a file called user.js in the same directory, which is under the user's control and is read but never written by Mozilla.

One caution with using user.js: prefs set to non-default values in user.js are also written to prefs.js, so removing or commenting out pref settings in user.js doesn't necessarily cause Mozilla to stop using your previous pref setting. If you change user.js and aren't getting the results you expect, be sure to check prefs.js to make sure it isn't setting a conflicting value.

Here are some prefs that folks have found useful, and which are set in user.js / about:config. See the related documents section to find more.

//
// user.js: Personal prefs which mozilla shouldn't overwrite.
//

////////////////////////////////////////////////////////////
// Turning off annoyances
////////////////////////////////////////////////////////////

// Disable blinking text:
user_pref("browser.blink_allowed", false);

// Image animation mode: normal, once, none.
// This pref now has UI under Privacy & Security->Images.
user_pref("image.animation_mode", "once");

// Show pref UI to block images that don't come from the current server
// This is shown by default in Mozilla.
user_pref("imageblocker.enable", true);

// Turn that annoying autocomplete popup REALLY off:
// (This actually has a UI but it's buried.)
user_pref("browser.urlbar.autocomplete.enabled", false);
user_pref("browser.urlbar.showPopup", false);
user_pref("browser.urlbar.showSearch", false);

// Turn off the download manager (0=download manager, 1=simple dialog?)
user_pref("browser.downloadmanager.behavior", 1);

// Enable the marquee tag (disabled by default):
user_pref("browser.display.enable_marquee", true);

////////////////////////////////////////////////////////////
// Platform parity/UI issues
////////////////////////////////////////////////////////////

// Key modifier stuff: see bug 22515
// Motif-style access keys:
user_pref("ui.key.accelKey", 18);
user_pref("ui.key.menuAccessKey", 0);
//user_pref("ui.key.menuAccessKeyFocuses", false);

// Windows-style access keys:
//user_pref("ui.key.accelKey", 17);
//user_pref("ui.key.menuAccessKey", 18);
//user_pref("ui.key.menuAccessKeyFocuses", true);

// Uncomment this to turn off Unix-style autocopy
// (or set it to true to turn it on on non-Unix platforms):
//user_pref("clipboard.autocopy", false);

// Middle mouse prefs: true by default on Unix, false on other platforms.
user_pref("middlemouse.paste", false);
user_pref("middlemouse.openNewWindow", true);
user_pref("middlemouse.contentLoadURL", false);
user_pref("middlemouse.scrollbarPosition", false);

// Newline paste behavior: 0=paste unchanged, 1=paste only
// first line, 2=replace with spaces, 3=strip newlines
//user_pref("editor.singleLine.pasteNewlines", 0);

// Bug in Netscape 6 branch: drag out of frame style pref was
// never initialized on Unix, so dragging below a line of text
// doesn't snap selection to the end of the line.
//pref("browser.drag_out_of_frame_style", 1);

////////////////////////////////////////////////////////////
// UI look-and-feel issues
////////////////////////////////////////////////////////////

// Tab focus model bit field:
// 1 focuses text controls, 2 focuses other form elements,
// 4 adds links.
// Most users will want 1, 3, or 7.
user_pref("accessibility.tabfocus", 1);

// Don't ever show me a font smaller than this: see bug 30910.
// This is the new cross-platform pref; the old Unix-only
// font.min-size pref is deprecated and will be removed soon.
// A UI is now in place for this pref, and can be found under
// Appearance->Fonts.
user_pref("font.minimum-size.x-western", 13);

// X font banning: see bug 104075.
// Ban all arial fonts, because abiword installs an ugly one
// and there doesn't seem to be a good one available:
user_pref("font.x11.rejectfontpattern", "fname=.*arial.*");

// Some alternate forms for rejectfontpattern:
// "fname=.*arial.*;scalable=.*;outline_scaled=.*;\
// xdisplay=.*;xdpy=.*;ydpy=.*;xdevice=.*");
// "fname=-zz-abiword.*;scalable=false;outline_scaled=false;");
// Alternately, reject font if accept pattern does not match it:
//user_pref("font.x11.acceptfontpattern", ".*");

// Set the submenu delay to be really long.
// This means that menus will stay posted until I click somewhere,
// making them behave more like Motif menus instead of un-posting
// whenever my mouse strays one pixel off the menu or cuts
// across the border between a menu and a submenu:
user_pref("ui.submenuDelay", 7000);

// Typeahead find configuration:
user_pref("accessibility.typeaheadfind", true);
user_pref("accessibility.typeaheadfind.linksonly", true);
user_pref("accessibility.typeaheadfind.startlinksonly", false);
user_pref("accessibility.typeaheadfind.timeout", 5000);

// Set select colors for text:
user_pref("ui.textSelectBackground", "green");
user_pref("ui.textSelectForeground", "white");
// Select color for typeahead find is slightly different:
user_pref("ui.textSelectBackgroundAttention", "blue");
// Not clear when/if widgetSelectBackground ever gets called: let's find out.
user_pref("ui.widgetSelectBackground", "orange");

////////////////////////////////////////////////////////////
// Control of popup windows
////////////////////////////////////////////////////////////

// Use configurable security policies to override popups, see
// http://www.mozilla.org/projects/security/components/ConfigPolicy.html
// Turn window.open off for particular sites:
user_pref("capability.policy.popupsites.sites", "http://www.annoyingsite1.com http://www.popupsite2.com");
user_pref("capability.policy.popupsites.Window.open","noAccess");
// Or turn it off everywhere:
user_pref("capability.policy.default.Window.open","noAccess");

// Disable JS windows popping up without direct action from the user
// (as lots of porn and spam sites do):
// (All recent Firefox and Suite builds have a UI for this pref)
user_pref("dom.disable_open_during_load", true);

// Open links from external apps into a new tab
// (Firefox 1.0 builds have a UI for this pref in the Options dialog)
// (May not work quite right in 1.8a Suite builds on Windows)
user_pref("browser.link.open_external", 3);
// Force new windows into tabs
// (Firefox 1.0+ builds have a UI for this pref in the Options dialog)
user_pref("browser.link.open_newwindow", 3);
// Make the above pref apply only to targeted links, not window.open
user_pref("browser.link.open_newwindow.restriction", 1);
// Don't focus new tabs opened by left-click or external URL
user_pref("browser.tabs.loadDivertedInBackground", true);
// Don't focus new tabs opened by middle-click or ctrl-click
// (All recent Firefox and Suite builds have a UI for this pref)
user_pref("browser.tabs.loadInBackground", true);

// It is now possible to disable the JavaScript window.open() method
// when it is not called as a result of a mouse click.
// When the dom.disable_open_click_delay pref is set to a non-zero
// number, window.open will fail when called more than that number
// of milliseconds after a mouse click.
user_pref("dom.disable_open_click_delay", 1000);

////////////////////////////////////////////////////////////
// Miscellaneous stuff
////////////////////////////////////////////////////////////

// Override the default user-agent string:
user_pref("general.useragent.override", "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0; hi, Mom) Gecko/20020604");

// Syntax highlighting in View Source.
// This has a UI under Appearance->Colors
user_pref("browser.view_source.syntax_highlight", false);

// In chatzilla, show original text in addition to smiley substitutions:
user_pref("extensions.irc.munger.smileyText", true);

// Wrap column for html output from the editor:
user_pref("editor.htmlWrapColumn", 72);

// Show JS warnings. This is also available in the Debug panel
// under Preferences.
user_pref("javascript.options.strict", true);

// Change default paper size from US-Letter to A4:
//user_pref("print.postscript.paper_size", "A4");


////////////////////////////////////////////////////////////
// Useful mail/news prefs
////////////////////////////////////////////////////////////

// 0=bottom 1=top 2=select+bottom 3=select+top
// Mozilla defaults it to 0, but Netscape defaults it to 1 (yuck).
user_pref("mailnews.reply_on_top", 0);

// Show the user agent of incoming messages
user_pref("mailnews.headers.showUserAgent", true);

// Turn off the history addrbook
user_pref("mail.collect_email_address", false);

// Turn off graphical reply style in the message window
user_pref("mail.quoted_graphical", false);
// display glyph, see http://www.bucksch.org/1/projects/mozilla/16507
user_pref("mail.display_glyph", true);   

// use HTML-style quoting for quoting plain text (during HTML replies)
user_pref("mail.quoteasblock", true);

// Format=flowed prefs, RFC 2646
user_pref("mailnews.send_plaintext_flowed", true);
user_pref("mailnews.display.disable_format_flowed_support", true);
user_pref("mail.display_struct", true);
user_pref("mail.send_struct", false);

I'm sure there are other useful hidden prefs. Please add them to the list so that others can benefit from them too!


UI Widget Look and Feel

A lot of Mozilla's look and feel which isn't controlled by CSS is controlled by a so-called "Look and Feel" object. This typically attempts to mimic the OS behavior on the current platform, with the user's settings for color, etc., but it doesn't always succeed; or there may be cases where a user wants to configure Mozilla differently from the rest of the OS. For that reason, Look and Feel settings can be overridden using preferences.

Here is the current list of look and feel prefs as of the last time this section was modified. For the most up-to-date version, the source file nsXPLookAndFeel.cpp is always the most current. Note: not all of these prefs actually do anything, and some work on some platforms and not others. Experiment.

Integer look-and-feel prefs

  • ui.windowTitleHeight
  • ui.windowBorderWidth
  • ui.windowBorderHeight
  • ui.widget3DBorder
  • ui.textFieldBorder
  • ui.textFieldHeight
  • ui.buttonHorizontalInsidePaddingNavQuirks
  • ui.buttonHorizontalInsidePaddingOffsetNavQuirks
  • ui.checkboxSize
  • ui.radioboxSize
  • ui.textHorizontalInsideMinimumPadding
  • ui.textVerticalInsidePadding
  • ui.textShouldUseVerticalInsidePadding
  • ui.textShouldUseHorizontalInsideMinimumPadding
  • ui.listShouldUseHorizontalInsideMinimumPadding
  • ui.listHorizontalInsideMinimumPadding
  • ui.listShouldUseVerticalInsidePadding
  • ui.listVerticalInsidePadding
  • ui.caretBlinkTime
  • ui.caretWidthTwips
  • ui.submenuDelay
  • ui.menusCanOverlapOSBar

Floating point look-and-feel prefs

  • ui.textFieldVerticalInsidePadding
  • ui.textFieldHorizontalInsidePadding
  • ui.textAreaVerticalInsidePadding
  • ui.textAreaHorizontalInsidePadding
  • ui.listVerticalInsidePadding
  • ui.listHorizontalInsidePadding
  • ui.buttonVerticalInsidePadding
  • ui.buttonHorizontalInsidePadding

Color look-and-feel prefs

(It's not clear whether these actually work.)

  • ui.windowBackground
  • ui.windowForeground
  • ui.widgetBackground
  • ui.widgetForeground
  • ui.widgetSelectBackground
  • ui.widgetSelectForeground
  • ui.widget3DHighlight
  • ui.widget3DShadow
  • ui.textBackground
  • ui.textForeground
  • ui.textSelectBackground
  • ui.textSelectForeground
  • ui.activeborder
  • ui.activecaption
  • ui.appworkspace
  • ui.background
  • ui.captiontext
  • ui.graytext
  • ui.highlight
  • ui.highlighttext
  • ui.inactiveborder
  • ui.inactivecaption
  • ui.inactivecaptiontext
  • ui.infobackground
  • ui.infotext
  • ui.menu
  • ui.menutext
  • ui.scrollbar
  • ui.threedface
  • ui.buttonface
  • ui.buttonhighlight
  • ui.threedhighlight
  • ui.buttontext
  • ui.buttonshadow
  • ui.threeddarkshadow
  • ui.threedshadow
  • ui.threedlightshadow
  • ui.window
  • ui.windowframe
  • ui.windowtext
  • ui.-moz-field

Akkana Peck, akkzilla at shallowsky dot com