Setting up Firefox on a new system

A number of configuration changes to Firefox are necessary on a new system before it is efficient and convenient to use. This post has step-by-step instructions for how I set up Firefox from scratch.

The steps

Remember the open tabs

You do not want to lose the state that is the current set of tabs open in Firefox.

In old Firefox speak, it is “restore session”.

Change it in the hamburger menu (upper right) → “Settings” → “General” (left panel) → section “Startup” (the first section) → check “Open previous windows and tabs”.

Make Ctrl + Tab behave the normal way

That is, just a simple move of the current tab to the right. Similar for Shift + Ctrl + Tab (to the left). This is the desired behaviour, incl. consistency with other applications (e.g., Geany) and with macro keyboards to support this very, very common operation without the need to use modifier keys.

Change it in the hamburger menu (upper right) → “Settings” → “General” (left panel) → section “Tab” (the second section) → uncheck “Ctrl+Tab cycles through tabs in recently used order”. Note that in later versions of Firefox, this may be the default, and it is thus not necessary to change.

Make Firefox ask for a download location

Instead of placing it in some hard-to-locate download folder.

Change it in the hamburger menu (upper right) → “Settings” → “General” (left panel) → section “Files and Applications” (about 40% down) → check “Always ask you where to save files”.

Enable keyboard navigation of links on a page

So that we can avoid using the mouse. Ideal would be navigation with the arrow keys, like in Opera, but this is almost as good:

Jump to links that start with the typed letters. Usually only one or two keystrokes are unique enough to get to the destination (sometimes combined with page search (Ctrl + F)). The link can then be opened by pressing Enter (or Shift + Ctrl + Enter to open in a new tab).

Setup:

  1. Hamburger menu (upper right) → SettingsGeneral. Under headline Browsing (scroll 80% down) → Search for text when I start typing. Turn this option on.
  2. Set option to only go to links; in the address bar enter

    about:config

    followed by Enter. Then: press Accept the Risk and Continue!, find the line accessibility.typeaheadfind.linksonly (e.g., by pasting in “linksonly” to the search field), select the “toggle” icon (e.g., by TABing to it) and change the value to True by hitting Enter.

  3. Optional (will make matching during typing less specific): Turn off case-sensitivity. Set accessibility.typeaheadfind.casesensitive to 0 (same procedure as for accessibility.typeaheadfind.linksonly, see above. When Enter is pressed, a dialog box will appear with the current value. Type 0 and press Enter). In later Firefox versions, this may be the default value.

Courtesy Firefox: non-Vimperator way to do mouseless browsing? by the undersigned.

Make the visited link indication on pages distinct

By default, Firefox has way too low contrast to clearly see if a link has been visited or not (e.g., changing from one shade of blue to a slightly different shade of blue). It doesn’t work well on sites with dark mode either. An orange-red colour works reasonably well on both sites with a light background and a dark mode.

Setup:

  1. Open the folder for the current Firefox profile:
    about:profiles in the address bar (e.g., Ctrl + T, Ctrl + V, Enter).
    For the row “Root Directory” for the currently active profile (often the name is “default-release” or “default” and there is the headline “This is the profile in use and it cannot be deleted.”):
    Press “Open Directory” or “Open Folder” on the right. Samples: /home/mortensen/.mozilla/firefox/moi8yf2e.default (on Linux) and C:\Users\embo\AppData\Roaming\Mozilla\Firefox\Profiles\0l94bqdj.default-release (on Windows).
    Note: If it is intercepted by ‘Catfish’ on Linux, press “Other…” in the dropdown on the left to reveal the path, right click on the selected folder, select “Copy Location”, and use the copied folder path to go to the folder in the file manager (for example, Thunar. Ctrl + L, Ctrl + V, Enter). Ctrl + H may have to be pressed to show the hidden folder “.mozilla”
  2. Open folder “chrome” (no, this has nothing to do with the Google Chrome web browser). If the folder does not exist already, create it.
  3. Edit (or create if it is not there) the file userContent.css.
  4. Add this line:
    a:visited { color: OrangeRed!important; }
  5. In the address bar, enter

    about:config

    followed by Enter. Then: press Accept the Risk and Continue!, find the line toolkit.legacyUserProfileCustomizations.stylesheet (e.g., by pasting in “legacyUserProfileCustomizations” to the search field). Select the “toggle” icon (e.g., by TABing to it) and change the value to True by hitting Enter.

  6. In most cases Firefox has to be restarted before it takes effect.

Note: Similarly, we can also set the colour for unvisited links. See appendix A for details. Though it works fine with only changing the visited link colour.

Courtesy How can I change link colors in Firefox and Chrome, but leave all other colors and fonts as they are? by terdon.

Block all JavaScript content by default (for security reasons)

Install NoScript:

  1. Download the .xpi file from the download page. Sample direct download URL.
  2. Install it by menu “File”“Open File…” → find and select the downloaded .xpi file (e.g. “noscript-11.4.6.xpi”) → press “Open” → press “Add” → press “Okay”.

Despite the promises, some sites are enabled by default anyway (e.g., for convenience). Change some of them to disabled by default:

  • utimg.com. For YouTube. But it is not required for playing videos, only youtube.com.
  • yimg.com. For YouTube. As for utimg.com.

One way is to open the global list: Click the NoScript icon on the upper right, click on the settings icon (to the left, third icon from the left), and click on the second tab (“Permissions per site”).

Allow some JavaScript content

For full use of Stack Exchange (two sites), it is:

  • stackoverflow.com
  • superuser.com
  • sstatic.net

It is in order to be able to vote, e.g. on comments, and other operations.

It is easiest to open these two pages and then change the setting for the three domains to “Trusted” by clicking on the NoScript icon in the upper right, etc:

Keyboard shortcuts for changing NoScript settings are actually partially supported. Only the initial left click on the icon is required (and this can be coded into a macro keyboard). In other words, it is possible to operate NoScript without mouse clicks.

Bookmark the jump page

Open and bookmark the jump page: Open menu “Bookmarks” (Alt + B) → “Bookmark Current Tab”. Or Ctrl + D.

The bookmark will initially be misplaced. Open menu “Bookmarks” (Alt + B) → “Manage bookmarks”. Move the new bookmark to “Bookmarks Menu” (for example, from “Bookmarks Toolbar”).

Test the keyboard shortcut to it: Alt + B, J

Log into Stack Exchange

For example, into Stack Overflow.

Avoid using the default search engine

Create a bookmark to the preferred search engine and assign “g” as the shortcut (“Keyword” in Firefox parlance). E.g., “https://duckduckgo.com/html/?q=%s” with bookmark name “Search – through DuckDuckGo”.

Put the bookmark in “Other bookmarks”, so it doesn’t clutter up in the “Bookmarks” menu.

The field “Keyword” can not be set at the bookmark addition time. Instead, after adding the bookmark, change it in menu “Bookmarks” (e.g., by keyboard shortcut Alt + B) → “Manage Bookmarks”“All Bookmarks” (left panel) → “Other Bookmarks” (left panel) → <select the bookmark> → set field “Keyword” (the fourth field) to “g” (note: it is changed immediately; there isn’t any OK button or similar to confirm the change).

More search engine shortcuts

Here is a list of shortcuts for more specific searches, using bookmarks as in the previous section. They attempt to restrict the search to a particular site (but the search engines often don’t respect the restriction).

Name URL Keyword
Wikipedia – through DuckDuckGo https://duckduckgo.com/html/?q=site%3Aen.wikipedia.org+%s wg
Wiktionary – through DuckDuckGo https://duckduckgo.com/html/?q=site%3Aen.wiktionary.org+%s wt
Stack Overflow – through DuckDuckGo https://html.duckduckgo.com/html/?q=site%3Astackoverflow.com+%s s
Super User – through DuckDuckGo https://duckduckgo.com/html/?q=site%3Asuperuser.com+%s sug

Note that “:” must be encoded as “%3A” in the URL.

Note that the “site:xxx.xx” part may not actually work for DuckDuckGo. It may be better to use the common title for a site’s pages instead (at the expense of a lower search specificity); the content of the HTML <title> tag (use Ctrl + U to find it). Example: use “Wikipedia” instead of “site:en.wikipedia.org” (encoded as “site%3Aen.wikipedia.org”).

Create one or more extra profiles

“Profiles” can be used in Firefox to provide separation, in effect like having several instances of Firefox installed. For instance, to separate work-related content and/or have a profile dedicated to video from YouTube and Odysee.

Note that each profile must be set up from scratch, like described in this blog post.

Create a new profile: Enter about:profiles in the address bar and press Enter. Press “Create new profile”. Enter a name for the profile, e.g. “Video”. Choose “Choose Folder” to give the folder on disk a recognisable name (e.g., for use in backup and transfer of the profile data to another system, like after a computer hardware breakdown…), e.g. “Profile_Video”. Note that the folder must be manually created in the file dialog: Right-click in file list field, select “Create folder” and enter the name, e.g. “Profile_Video”.

The new profile will be set as the default profile, but this is usually not the desired state. Set the original profile (usually by the name “default” or “default-release” (yes, it is all lowercase for some weird reason)) as the default: Press “Set as default profile” for it.

Launch the new profile by clicking “Launch profile in new browser” for the new profile, e.g. “Video”.

Set up the new profile as described in this blog post.

Add about:profiles to bookmarks. The default name will be “About Profiles” and thus the keyboard shortcut will be Alt + B, A.

Note that for opening a list of URLs in the new profile, the default must be (temporarily) changed to it: Press “Select as default” for the profile, e.g. “Video”. In order for it to work, it is usually required to restart all the currently open profiles/Firefox: Close all instances of Firefox and then start Firefox anew (it will open the new default profile. The other profiles need to be started from the about:profiles page).

Appendix A: How can I change link colors in Firefox and Chrome, but leave all other colors and fonts as they are?

Firefox

You can do this by editing (or creating if it is not there) the file userContent.css. Its location depends on the platform (the parent folder can also be found in menu Help"More Troubleshooting Information" → section "Application Basics" → field "Profile Directory" ("Profile Folder" on Windows). An alternative way to using the menus to open the Troubleshooting Information page is the "URL" about:support. To find the location for other than the current active profile, use the "URL" about:profiles (will open the "About Profiles" page) and press button "Open Directory" in the "Root Directory" row for a profile):

Linux

  • $HOME/.mozilla/firefox/[xyz].default-release/chrome/userContent.css

Windows

Depending on the Windows version and other configuration, userContent.css is in one of the following folders:

  • C:\Documents and Settings\[username]\Application Data\Mozilla\Firefox\Profiles\[xyz].default\chrome.
  • C:\Users\[username]\AppData\Roaming\Mozilla\Firefox\Profiles\[xyz].default\chrome (more generally, it is %APPDATA%\Mozilla\Firefox\Profiles\[xyz].default\chrome).

Common for Linux and Windows

You may have to create the chrome subdirectory and the file userContent.css.

Add these lines to that file to change the colors (obviously, you can change the actual colors used to whatever you prefer – e.g., using Paletton Live Colorizer):

a { color: #333388!important; }  /* Unvisited link color */

a:visited { color: #333340!important; }  /* Visited link color */

For sites with a dark mode, for example, Stack Overflow, the unvisited color may not work well. Choose another or leave it out by deleting or outcommenting the a { color: #333388!important; } line. Note: Only the C-style comment character sequence “/* */” works in CSS (in contrast to, say, C++ or JavaScript)!

Also, for later versions of Firefox (69 and later), check that toolkit.legacyUserProfileCustomizations.stylesheet in about:config is true. In some cases it is automatically set to true when file userContent.css is created, but that is not always the case.

In most cases Firefox has to be restarted before it takes effect (or rather, the profile in which these settings have been changed. There is a current active profile, but if more than one is in active use, this has to be considered).

Note that both file userContent.css and setting toolkit.legacyUserProfileCustomizations.stylesheet are per profile (they are not global settings), so if using more than one profile it must be copied to the sub folder in the particular profile folder, and set in each profile, respectively. The same goes for restarting – close the corresponding window and in the case of a non-default profile, open it from the default profile (e.g., from "URL" about:profiles).

Chrome

You can do the same for Chrome by editing $HOME/.config/google-chrome/Default/User\ StyleSheets/Custom.css which on Windows, is located at %USERPROFILE%\AppData\Local\Google\Chrome\User Data\Default\User StyleSheets\Custom.css.

Courtesy How can I change link colors in Firefox and Chrome, but leave all other colors and fonts as they are? by terdon.

Leave a Reply

Your email address will not be published. Required fields are marked *

*