Menu customization: Difference between revisions

From MozillaZine Knowledge Base
Jump to navigationJump to search
m (→‎Menu Editor and Menu Wizard extension: grammar: are a better choice -> are better choices)
 
(16 intermediate revisions by 6 users not shown)
Line 1: Line 1:
See also: [http://menueditor.mozdev.org/ Menu Editor] extension. It allows you hide the menu items as well as reorder them.
There are several ways to tweak menus of your XUL-based application, like Mozilla Suite, Thunderbird or Firefox.


First you need to locate your [[Profile Folder | profile folder]]. There's a subfolder called "chrome". What you need to do is edit the userChrome.css file. Create it if it does not exists.
==Menu Editor and Menu Wizard extension==
The [http://menueditor.mozdev.org/ Menu Editor] extension allows you hide the menu items as well as reorder them. However, it doesn't seem to be actively maintained anymore. The [https://addons.mozilla.org/en-US/firefox/addon/s3menu-wizard/?src=cb-dl-mostpopular Menu Wizard] (Firefox) and [https://addons.mozilla.org/en-US/thunderbird/addon/s3menu-wizard/?src=cb-dl-mostpopular Menu Wizard] (Thunderbird) add-ons are better choices.


You can hide any context menu items by adding this line to userChrome.css:
[http://forums.mozillazine.org/viewtopic.php?t=264171 Menu Editor 1.2 discussion thread] on MozillaZine forums.
 
==ContextMenu Extensions extension==
 
[http://piro.sakura.ne.jp/xul/doc/ctxextensions/help.xml.en This extension] allows context menu items to be added according to user-defined scripts, offering the possibility for the user to add, for example, a context menu item which appends text to the beginning, middle, or end of a right-clicked URL to allow the predictably modified URL to appear in a new window.
 
==Various Other Extensions==
 
Assorted extensions may add context menus (or general menu items) depending on the extension.
 
Context menu extensions which allow customization of the context menu include:
 
* [https://addons.mozilla.org/extensions/moreinfo.php?id=240&application=firefox Context Search] - Adds search plugins (which are customizable) to the context menu (searches highlighted text).
* [https://addons.mozilla.org/extensions/moreinfo.php?id=68&application=firefox Dictionary Search] - Allows searching of user-defined websites (not only dictionaries) through wildcard (works on selected text, not a selected link)
* [http://www.extensionsmirror.nl/index.php?showtopic=327 Ook] - Allows bookmarks (which are of course customizable by the user) to be added to the context menu
 
===Wiki/Forum-relevant extensions===
The [https://addons.mozilla.org/en-US/firefox/addon/wikipedia-context-menu-search/?src=ss Wikipedia Context Menu Search] extension lets you search for highlighted text on Wikipedia via the context menu. Another useful extension for wiki editing is the [https://addons.mozilla.org/en-US/firefox/addon/save-text-area/?src=ss "Save Text Area"] extension which allows saving text from and loading text into textboxes.
 
==Tweaking userChrome.css==
If you don't want to install the Menu Wizard extension you can tweak your menus using [[userChrome.css]]. First locate your [[profile folder]]. There's a subfolder called "chrome". What you need to do is edit the "userChrome.css" file (create it if it does not exists).
 
===Using ID selectors===
Add a line like this to hide any menu item:
  #id1, #id2 { display:none !important; }
  #id1, #id2 { display:none !important; }
replacing each of the identifiers #id1, #id2, ... with one of the following:
replacing each of the identifiers #id1, #id2, ... with one of the selectors from [[UserChrome.css Element Names/IDs#Firefox menus]].
 
{| border cellspacing="0" cellpadding="5"
! #id !! label
|-
| #context-openlink
| Open Link in New Window
|-
| #context-openlinkintab
| Open Link in New Tab
|-
| #context-sep-open
| align="center" | ''line separator''
|-
| #context-bookmarklink
| Bookmark This Link...
|-
| #context-savelink
| Save Link As...
|-
| #context-sendlink
| Send Link...
|-
| #context-copyemail
| Copy Email Address
|-
| #context-copylink
| Copy Link Location
|-
| #context-sep-copylink
| align="center" | ''line separator''
|-
| #context-viewimage
| View Image
|-
| #context-copyimage-contents
| Copy Image
|-
| #context-copyimage
| Copy Image Location
|-
| #context-sep-copyimage
| align="center" | ''line separator''
|-
| #context-saveimage
| Save Image As...
|-
| #context-sendimage
| Send Image...
|-
| #context-setWallpaper
| Set As Wallpaper...
|-
| #context-blockimage
| Block Images from...
|-
| #context-back
| Back
|-
| #context-forward
| Forward
|-
| #context-reload
| Reload
|-
| #context-stop
| Stop
|-
| #context-sep-stop
| align="center" | ''line separator''
|-
| #context-bookmarkpage
| Bookmark This Page...
|-
| #context-savepage
| Save Page As...
|-
| #context-sendpage
| Send Page...
|-
| #context-sep-viewbgimage
| align="center" | ''line separator''
|-
| #context-viewbgimage
| View Background Image
|-
| #context-undo
| Undo
|-
| #context-sep-undo
| align="center" | ''line separator''
|-
| #context-cut
| Cut
|-
| #context-copy
| Copy
|-
| #context-paste
| Paste
|-
| #context-delete
| Delete
|-
| #context-sep-paste
| align="center" | ''line separator''
|-
| #context-selectall
| Select All
|-
| #context-sep-selectall
| align="center" | ''line separator''
|-
| #context-keywordfield
| Add a Keyword for this Search...
|-
| #context-searchselect
| Search Web for ...
|-
| #frame-sep
| align="center" | ''line separator''
|-
| #frame
| This Frame
|-
| #context-sep-properties
| align="center" | ''line separator''
|-
| #context-viewpartialsource-selection
| View Selection Source
|-
| #context-viewpartialsource-mathml
| View MathML Source
|-
| #context-viewsource
| View Page Source
|-
| #context-viewinfo
| View Page Info
|-
| #context-metadata
| Properties
|-
| #context-sep-bidi
| align="center" | ''line separator''
|-
| #context-bidi-text-direction-toggle
| Switch Text Direction
|-
| #context-bidi-page-direction-toggle
| Switch Page Direction
|}


Example (hides the "View Background" menu item and the horizontal line after it):
Example (hides the "View Background" menu item and the horizontal line after it):
Line 164: Line 37:
  }
  }


==Using Label==
===Using attribute selectors===
The easiest way to change the style of a menu item is using the '''''Label''''' property.
Another way to change the style of a menu item is to use the '''label''' attribute selector.


For example, if you want to hide the "Close Tab" menu item on the tab context menu:
For example, if you want to hide the "Close Tab" menu item on the tab bar context menu:
  menuitem[label="Close Tab"] {
  menuitem[label="Close Tab"] {
     display: none !important;
     display: none !important;
Line 176: Line 49:
     text-decoration: line-through !important;
     text-decoration: line-through !important;
  }
  }
[[Category:Visual customizations (Firefox)]]
[[Category:Visual customizations (Thunderbird)]]

Latest revision as of 03:23, 17 January 2017

There are several ways to tweak menus of your XUL-based application, like Mozilla Suite, Thunderbird or Firefox.

Menu Editor and Menu Wizard extension

The Menu Editor extension allows you hide the menu items as well as reorder them. However, it doesn't seem to be actively maintained anymore. The Menu Wizard (Firefox) and Menu Wizard (Thunderbird) add-ons are better choices.

Menu Editor 1.2 discussion thread on MozillaZine forums.

ContextMenu Extensions extension

This extension allows context menu items to be added according to user-defined scripts, offering the possibility for the user to add, for example, a context menu item which appends text to the beginning, middle, or end of a right-clicked URL to allow the predictably modified URL to appear in a new window.

Various Other Extensions

Assorted extensions may add context menus (or general menu items) depending on the extension.

Context menu extensions which allow customization of the context menu include:

  • Context Search - Adds search plugins (which are customizable) to the context menu (searches highlighted text).
  • Dictionary Search - Allows searching of user-defined websites (not only dictionaries) through wildcard (works on selected text, not a selected link)
  • Ook - Allows bookmarks (which are of course customizable by the user) to be added to the context menu

Wiki/Forum-relevant extensions

The Wikipedia Context Menu Search extension lets you search for highlighted text on Wikipedia via the context menu. Another useful extension for wiki editing is the "Save Text Area" extension which allows saving text from and loading text into textboxes.

Tweaking userChrome.css

If you don't want to install the Menu Wizard extension you can tweak your menus using userChrome.css. First locate your profile folder. There's a subfolder called "chrome". What you need to do is edit the "userChrome.css" file (create it if it does not exists).

Using ID selectors

Add a line like this to hide any menu item:

#id1, #id2 { display:none !important; }

replacing each of the identifiers #id1, #id2, ... with one of the selectors from UserChrome.css Element Names/IDs#Firefox menus.

Example (hides the "View Background" menu item and the horizontal line after it):

#context-viewbgimage,
#context-sep-viewbgimage {
  display: none !important;
}

Using attribute selectors

Another way to change the style of a menu item is to use the label attribute selector.

For example, if you want to hide the "Close Tab" menu item on the tab bar context menu:

menuitem[label="Close Tab"] {
    display: none !important;
}

or if you want to change the "For Internet Explorer Users" appearance on the "Help" menu:

menuitem[label="For Internet Explorer Users"] {
    text-decoration: line-through !important;
}