Finding and Editing the Opera INI Files

Opera is exceptionally customisable, and stores most of its setting in initialisation (INI) files. These files are usually stored in three main locations (see new official documentation here):

  1. On Windows:
    1. The main Opera program directory, which can usually be found at c:\program files\Opera (obviously dependant on user choice and localisation)
    2. Within the program directory there is a defaults subdirectory. This stores the original default INI files, and is used by Opera unless you customise them in the profile directory. These will be overwritten at each update of Opera.
    3. The profile directory. If you go to Help » About Opera » Paths » Opera directory (click here to see it), it will tell you where this directory is. The profile directory location depends on whether you installed for single or multi-user, and on your operating system.
  2. On Linux:
    1. The main Opera program directory, which is usually be found at /usr/share/opera.
    2. Within the program directory there is a ini subdirectory. This stores the original default INI files and is used by Opera unless you customise them in the profile directory. These will be overwritten at each update of Opera.
    3. The profile directory. This directory is usually located in the .opera subdirectory of your home directory. If you go to Help » About Opera » Paths » Opera directory (click here to see it), it will tell you where this directory is.
  3. On Mac OS X:
    1. The main Opera program directory, which is inside Opera.app -- for example, /Applications/Opera.app/Contents/Resources
    2. Within your user's preferences, usually in ~/Library/Preferences/Opera Preferences. Instead of editing Opera6.ini, you should edit Opera 8 Preferences in this directory on Mac OS X

INI-files are simply text files and quite easy to read and change. For a list of all internal commands (actions) with their syntax, see AllActions. In some commands you can use IniFileVariables, consisting of a percentage sign ("%") and a letter. (See VimIntegration for how get completion of actions in vim)

Since Opera V7.1x - it is better to make copies of the default INI files and modify these copies. You only need to put differences in these files[1], as Opera checks differences in the customised files, then uses the defaults for everything else. So copy and paste from the default files to your customised versions those sections you want to change.

INI files are generally composed of sections delimited by [ and ], followed by configurations lines. For example there are two sections ([Version] and [Info]) in the following INI extract:

; Menu specification file for Opera 7.0

[Version]
File Version=2

[Info]
Name=My menu prefs
Description=Personal Opera menu setup
Author=John Doe johndoe@example.org
Version=
Comments=This file contains only modified items...

The FILE VERSION string in the [Version] block must be at least 2, if the file is to be read by Opera.

In the [Info] block you can put in info about your file:
The NAME string defines what name the setup will have in Opera's preferences.
The DESCRIPTION string is not yet displayed, but can be used to put in a description of the file.
The AUTHOR string is not displayed yet either, but can hold info about the author. You can put an e-mail or web address here so people can reach you with questions.
The VERSION string is an internal file version. You can either use internal versioning, or put in the version of Opera these setups are intended for.
The COMMENTS string is an unofficial string first used by DarkElf, you can use this to specify a comment about the file which is only read by people editing the file.

Here is a list of the different INI files and their locations (more found here):

For those files which are overwritten on upgrades or reinstalls, you can get your old copies back from the \Uninst\Backup subdirectory in the program directory.

We will use an example tip from the OperaTips page - adding 'Open in FireFox' and 'Open in IE' to the right-click menu (but you can generalise the tecniques to other types of editing). From V7.1x, it is better to edit the files in the profile directory, not the defaults directory. So find your profile directory (see above), then go to the menu subdirectory. By default there is NO file here, so you have two options:

  1. EASIER: Copy standard_menu.ini from the defaults directory to profile/menu. Then edit this file - first edit the [version] section for the tip we are using and change the name line to something (e.g. Name=My customised menu - this is name string shown when you display the Preferences dialog). Next you need to go to the [Document Popup Menu] section and add the lines specified in the tip there. Save the file, then go to Opera Preferences » Toolbars and menus and select your new menu file.
  2. HARDER (but much better): Find your profile directory location and you'll find a menu subdirectory (if not, create it). Create an empty file in menu (my_menu.ini) and edit that, adding:
Opera Preferences version 2.0
; Menu specification file for Opera 7.0
; This file is stored in UTF-8 encoding

[Version]
File Version=2

[Info]
Name=My menu prefs
Description=Personal Opera menu setup
Comments=This file contains only modified items...
Author=
Version=1

This needs to be present at the top of each custom INI file. One created, then, for each menu section you want to customise, copy the whole section from the defaults/standard_menu.ini and paste in your new menu file; for the tip example we are dealing with, we want to modify [Document Popup Menu] section, so we copy that over and then make our edits. The full customised my_menu.ini should finally look like this:

Opera Preferences version 2.0
; Menu specification file for Opera 7.0
; This file is stored in UTF-8 encoding

[Version]
File Version=2

[Info]
Name=My menu prefs
Description=Personal Opera menu setup
Comments=This file contains only modified items...
Author=
Version=1

[Document Popup Menu]

Item, 50426,				= Back
Item, 50427,				= Forward
Item, 67648,				= Rewind
Item, 67649,				= Fast Forward
--------------------1
Item, 50428,				= Reload 
Submenu, 200000, Reload Menu
--------------------2
Item, 70464		= Add to bookmarks, 1
Item, 50215			= Copy document address
Item, 65178		= Send document address in mail
Item, "Open in IE"		= Execute program, "iexplore","%u"
Item, "Open in Firefox"	= Execute program, "firefox","%u"
--------------------3
Item, 50004				= Print document
Item, 44002				= View document source
Item, 70465			= Validate frame source
--------------------4
Include, Internal Frame
Include, Internal Document Background
--------------------5
Item, 50995			= Enter fullscreen | Leave fullscreen

Save this version, then go to Opera Preferences » Advanced » Toolbars and select your new menu file. This second method is much more future proof - Opera only loads the differences you made - so if a new version of Opera has new menu items in other menus, they will automatically appear, whereas with the simpler method, you'll have to re-edit everything each update (and that can be a lot of work...)

Need help determine which ini section handle which menu?
Use the Opera Browser helper menu.
It adds a menu item to each menu that will display a alert box with the menu section name.

Note: If you want to use a JavaScript Bookmarklet as a menu item you have to replace all quotation marks in the source code with single quotes.

A Tutorial on Customising the Mouse Gestures and Keyboard Bindings

OK, here is our next foray into customising Opera (assuming you have never done this before). This time, we will use the example of how to change the way Opera closes page tabs, so that after closing one, the tab to the right becomes active (like in FireFox). This uses the wonderful GUI built into preferences, so we don't even have to touch an INI file (Opera does the editing for you!) Opera contains an extensive list of internal commands that control every aspect of it's function. So, to close a page, there is the nice intuitive command "Close page", and to make the next tab along active, we use the command "Switch to next page". To add commands together we use the ampersand "&" to connect them.

The mouse gesture normally used to close pages is DOWN-RIGHT, to change it we do the following:

To change the keyboard binding (Ctrl+W) to close a page in the same way, follow the procedure above but this time for the keyboard setup. The program command will be the same as above, but the key command "Ctrl+W" is actually written as "w ctrl" in the Opera keyboard system. So find "w ctrl" in the list (there is a quick find search box at the top of the dialog to make it easier), and edit the command as above. Nice and simple huh?

If you want to get Opera to do Command-A OR Command-B, then you use the "|" symbol; for example to close the page tab, and if no more page tabs are open then close Opera instead, use this command:

Close page & Switch to next page | Exit

See CustomCommands for some more 'ready-made' commands you can use to customise your mouse and keyboard setup.

Available gestures

Button1 - left click (not subject to change)

Button2 - right click (not subject to change)

Button3 - middle click = mouse wheel click (action on link is not subject to change the described way, it can only be customized in Preferences - Advanced - Shortcuts - Middle click options)

Button4 to Button{x} - additional mouse buttons (like a thumb button for back, mouse wheel left+right for horizontal scrolling; some mouse drivers apply special functions and not the button clicks, but with them sometimes you can apply keyboard-shortcuts and make use of them in Opera with the drawback they may be useless in other applications; not sure what exactly works with Opera)

FlipForward - hold left button and click right button

FlipBack - hold right button and click left button

GestureUp - hold right button and move up

GestureDown - hold right button and move down

GestureRight - hold right button and move right

GestureLeft - hold right button and move left

Footnotes

[1] - This is somewhat complicated, because Opera's difference engine only works per section and not per line. So if you want to change a key command in the [Application] section, you have to copy THE WHOLE SECTION ([Application]), even if you only change one line within it...

Categories:

CategoryOpera
CategoryTutorial

Backlinks
There are 27 comments on this page. [Display and/or add comments]