Ubuntu – How to launch different firefox profiles via the keyboard using Unity

firefoxlaunchershortcut-keysunity

I'm a heavy user of firefox profiles – a general one, work and one just for facebook so facebook doesn't know where I'm browsing. I have customised my firefox launcher icon to give me access to profiles by right click.

However what I really want is to hit a key and type "face", hit enter and have the Facebook profile launched. Before Unity I had this by having multiple application launchers and then using gnome do to access them.

So how can I set up the same workflow with Unity? Is there a keyboard centric way to access the right click menu of launcher icons? Do I have to set up multiple launcher icons?

Best Answer

I eventually worked out a way to get what I want using .desktop files in ~/.local/share/applications that allows me to launch specific profiles from the dash.

The process for the facebook launcher is to copy the original firefox launcher into the above directory. Then edit two lines to give it a friendly name that the dash will match against, and a command that will launch firefox with the profile I want.

To copy the file:

mkdir -p ~/.local/share/applications/
cp /usr/share/applications/firefox.desktop ~/.local/share/applications/facefox.desktop

Then you need to edit two lines of the new file - Name= and Exec=. The Name line is near the top, and the Exec line is after lots of translations. Note that there is more than one Exec= line in the file, you want to edit the first one you find.

I edited them to be:

...
Name=Facebook Firefox Web Browser
...
Exec=firefox -P facebook -no-remote %u
...

Just to explain the Exec line, this is what you can type at a terminal to launch firefox, with:

  • %u being arguments that might be added by the desktop environment,
  • the -no-remote flag being required to allow more than one instance of firefox to run, and
  • -P facebook selects the profile to use.
Related Question