1

Recently I have been more and more using profiles in Firefox.

I have one for every member of the family, then some for proxied firefoxes (tor, i2p, freenet), then a "guest" default profile, and several profiles for development purposes.

Soooo, profile management starts to become important. And the very first problem I have, is to reorder them, for instance in this order :

Personal
Girlfriend
Children
Dev1
Dev2
Dev3
Testing
Freenet
Tor
etc ...

So, is there an addon, a trick to have that ordering ? I guess the other way round is to use gnome / mate, etc. menu options to start those profiles and manage them from there. But I'm now looking for a Firefox-only solution.

2 Answers 2

2

Ok, after testing many addons, I found a way to reorder my profiles. It is not in an addon (should be main feature in Firefox, but anyway...).

The trick is to edit your profiles.ini file. It is located, in linux, in ~/.mozilla/firefox/profiles.ini.

First, backup:

cp ~/.mozilla/firefox/profiles.ini ~/.mozilla/firefox/profiles.ini.bak

Second, edit:

vim ~/.mozilla/firefox/profiles.ini

You can then copy and paste the lines in order to have this the order you want :

[General]
StartWithLastProfile=1

[Profile0]
Name=Default
IsRelative=1
Path=fhsdjsufh.Default
Default=1

[Profile1]
Name=Myself
IsRelative=1
Path=dfhfkvldk.default

[Profile2]
Name=Children
IsRelative=1
Path=kfmfpoernv.Children

[Profile3]
Name=Friends
IsRelative=1
Path=fjvovbswk.Friends

I don't know if this is the best way, but it works. Please care to keep the formatting and titling as they are, just copy the lines between the [Profilex] titles.

Source : Mozillazine

1

I also use a lot of profiles. I use MozBackup to backup a base profile with addons I like. I restore that base onto profiles I later create using the popup when I run firefox.exe -P -no-remote.

I haven't found a way to sort the profile list in that popup in either Firefox nor MozBackup so I wrote a python script that sorts the entries by name in profiles.ini.

I'm on Windows but I use the Linux subsystem with Debian flavor to run this script. To install python 3.6:

apt-get install curl git build-essential zlib1g-dev libbz2-dev libreadline-dev libssl-dev libsqlite3-dev
curl https://pyenv.run | bash
pyenv install 3.6.8
pyenv local 3.6.8

Here is the script:

#!/usr/bin/env python3.6

import configparser
import re

config = configparser.ConfigParser()
config.optionxform = str
# this option is mandatory as list in popup will be blank
# if we let configparser default to lowercase option key.
config.read('profiles.ini')

nconfig = configparser.ConfigParser()
nconfig.optionxform = str
nconfig['General'] = config['General']

profiles = [section for section in config.sections() if re.match('^Profile', section)]
sorted_profiles = sorted(profiles, key=lambda profile: config[profile]['Name'])

for idx, profile in enumerate(sorted_profiles):
    # 2020-08-25 - fixed this line which was generating syntax error
    nconfig["Profile" + str(idx)] = config[profile]
    # dict are sorted in python 3.6
    # it seems profiles don't need to be renamed,
    # but let's fake we created them in order anyway.

with open('profiles.ini.new', 'w') as f:
    nconfig.write(f, space_around_delimiters=False)
1
  • This is a great script but had a syntax error in line 20 nconfig[f"Profile{idx}"] = config[profile]. Seems fixed now. Works great! Aug 25, 2020 at 14:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.