I followed the instructions present here in order to use two Firefox profiles simultaneously. But I would like to make this process faster by starting each profile from its own shortcut. How do I create a shortcut to launch each profile?
Ubuntu – How to create shortcuts to different Firefox profiles
firefox
Related Solutions
How to set up different Firefox profiles for the same Ubuntu user and the same Firefox installation
Excerpt of the command-line options from man firefox
:
-ProfileManager
Start the profilemanager. Use this to choose the profile you would like to
run firefox with. You will need to also use -no-remote if there is already
a running firefox instance.
-P profile
Start firefox with the profile named profile. Will start the profile
manager if a valid profile name is not specified. You will need to also
use -no-remote if there is already a running firefox instance.
So you just need to start Firefox with one of those parameters by either using a terminal, the Alt+F2 HUD, from the launcher icon's context menu after editing its configuration file, which I will describe below.
Set up a new profile:
Launch Firefox's ProfileManager from the terminal or with Alt+F2:
firefox -ProfileManager
Rename your current profile
default
toprofile1
(or whatever you like, you don't even have to rename it, but I will do in this guide for clarification - you just have to replaceprofile1
with your exact name wherever it occurs!) by clicking on Rename Profile....Create a new profile with the wizard by clicking on Create Profile.... It will show you an info window first, read it and click Next. The second window will ask you to enter a name for the profile, enter
profile2
here (or replace it wherever it occurs in this guide with exactly what you entered instead). I would recommend you not to change the folder where the profile will be stored in, unless you have a good reason to do so. Click Finish.Exit the ProfileManager.
Set up your launcher icon to access those profiles from the context menu:
Copy the original launcher file (which is owned by root, used system-wide and will get replaced with the next update) to your home folder:
cp /usr/share/applications/firefox.desktop ~/.local/share/applications/firefox.desktop
Edit the copy e.g. with either Gedit (GUI) or Nano (terminal):
gedit ~/.local/share/applications/firefox.desktop nano ~/.local/share/applications/firefox.desktop
Search for the line:
Actions=NewWindow;NewPrivateWindow;
and add new context menu action identifiers like this (example names, but only used within the file, you won't see them anywhere else):
Actions=NewWindow;NewPrivateWindow;Profile1;Profile2;ProfileManager;
Insert the code snippet below at the end of the file, you may vary the
Name=
value and add as many translations as you want (example for German [de] is given). TheExec=firefox -P ...
lines have to contain the exact (case-sensitive) name of the profiles you created in the profile manager! The-no-remote
flag allows multiple firefox profiles to run at the same time. Also the last word in the lines[Desktop Action ...]
has to exactly match the keys you added to theActions=
line above.[Desktop Action Profile1] Name=Run Firefox with profile 1 Name[de]=Firefox mit Profil 1 starten Exec=firefox -P profile1 -no-remote OnlyShowIn=Unity; [Desktop Action Profile2] Name=Run Firefox with profile 2 Name[de]=Firefox mit Profil 2 starten Exec=firefox -P profile2 -no-remote OnlyShowIn=Unity; [Desktop Action ProfileManager] Name=Open Firefox profile manager Name[de]=Firefox Profilmanager öffnen Exec=firefox -ProfileManager -no-remote OnlyShowIn=Unity;
Now if you want to specify a permanent default profile for when you left-click the launcher icon (otherwise the profile you last used through the ProfileManager with the respective checkbox ticked gets launched), you also have to edit the main
Exec=
line. It's the topmost and should look like this:Exec=firefox %u
Edit it to look like the one below, maybe replacing
profile1
with the correct default profile name you wish.Exec=firefox -P profile1 %u
You have to reboot (maybe logging out and back in is also enough?) before the system realizes that you want to override the system-wide
firefox.desktop
file and use your personal and customized one. Or you can use the commanddesktop-file-install --dir=~/.local/share/applications ~/.local/share/applications/firefox.desktop
to re-initiate the launcher file. After that, enjoy your multiple profiles!
Edit profile's .desktop file:
- add
--class SomeClass
to the end ofExec
key to change program's WM_CLASS value (see this article) - add new key
StartupWMClass=SomeClass
to the end of file (see this article and desktop entry specification)
The string SomeClass
must be the same in both changes.
Example .desktop file:
[Desktop Entry]
Name=Firefox Test
Exec=firefox -p test -no-remote --class FxTest
Terminal=false
Type=Application
StartupNotify=true
Icon=/path/to/custom/icon.png
StartupWMClass=FxTest
Best Answer
You can use your menu launcher creator (or right click the desktop and select new launcher, depending on what desktop you are on) to fashion two new
firefox
launchers. The command you need for each launcher is, for example:This will launch
firefox
with that profile and make sure that it doesn't connect to any other running instance offirefox
with the essential-no-remote
switch.If you wanted to do it manually, the desktop shortcut would look something like this; you could create it in a text-editor and name it
firefox2.desktop
:Something else I recommend is going to your firefox folder ( mine is
/home/mike/.mozilla/firefox
) and checking that theStartWithLastProfile
setting inprofiles.ini
is false:This is because it can get confusing if you are using different profiles and you start
firefox
as normal without using a special shortcut and it just loads the last profile used.You can also get prompted each time for which profile to use by making sure 'don't ask at startup' is unchecked, which is in the firefox
ProfileManager
settings below. This setting is reached withas noted in the question you referred to.
For more information on the command switches available for
firefox
seeman firefox
or the Ubuntu manpages online. Further support is available at mozilla.org.