Categories: Linux

Getting Firefox Nightly to stick to Ubuntu’s Unity Dock

I installed Ubuntu 16.04.1 this week and decided to try out Unity, the default window manager. After I installed Nightly I assumed it would be simple to get the icon to stay in the dock, but Unity seemed confused about Nightly vs the built-in Firefox (I assume because the executables have the same name).

It took some doing to get Nightly to stick to the Dock with its own icon. I retraced my steps and wrote them down below.

My goal was to be able to run a couple versions of Firefox with several profiles. I thought the easiest way to accomplish that would be to add a new icon for each version+profile combination and a single left click on the icon would run the profile I want.

After some research, I think the Unity way is to have a single icon for each version of Firefox, and then add <em>Actions</em> to it so you can right click on the icon and launch a specific profile from there.

Installing Nightly

If you don’t have Nighly yet, download Nightly (these steps should work fine with Aurora or Beta also). Open a terminal:

$ mkdir /opt/firefox
$ tar -xvjf ~/Downloads/firefox-51.0a1.en-US.linux-x86_64.tar.bz2 /opt

You may need to chown some directories to get that in /opt which is fine. At the end of the day, make sure your regular user can write to the directory or else you won’t be able to install Nightly’s updates.

Adding the icon to the dock

Then create a file in your home directory named nightly.desktop and paste this into it:

[Desktop Entry]
Version=1.0
Name=Nightly
Comment=Browse the World Wide Web
Icon=/opt/firefox/browser/icons/mozicon128.png
Exec=/opt/firefox/firefox %u
Terminal=false
Type=Application
Categories=Network;WebBrowser;
Actions=Default;Mozilla;ProfileManager;

[Desktop Action Default]
Name=Default Profile
Exec=/opt/firefox/firefox –no-remote -P minefield-default

[Desktop Action Mozilla]
Name=Mozilla Profile
Exec=/opt/firefox/firefox –no-remote -P minefield-mozilla

[Desktop Action ProfileManager]
Name=Profile Manager
Exec=/opt/firefox/firefox –no-remote –profile-manager

Adjust anything that looks like it should change, the main callout being the Exec line should have the names of the profiles you want to use (in the above file mine are called minefield-default and minefield-mozilla). If you have more profiles just make more copies of that section and name them appropriately.

If you think you’ve got it, run this command:

$ desktop-file-validate nightly.desktop

No output? Great — it passed the validator. Now install it:

$ desktop-file-install --dir=.local/share/applications nightly.desktop

Two notes on this command:

  • If you leave off –dir it will write to /usr/share/applications/ and affect all users of the computer. You’ll probably need to sudo the command if you want that.
  • Something is weird with the parsing. Originally I passed in –dir=~/.local/… and it literally made a directory named ~ in my home directory, so, if the menu isn’t updating, double check the file is getting copied to the right spot.

Some people report having to run unity again to get the change to appear, but it showed up for me. Now left-clicking runs Nightly and right-clicking opens a menu asking me which profile I want to use.

Screenshot of menu

Right-click menu for Nightly in Unity’s Dock.

Modifying the Firefox Launcher

I also wanted to launch profiles off the regular Firefox icon in the same way.

The easiest way to do that is to copy the built-in one from /usr/share/applications/firefox.desktop and modify it to suit you. Conveniently, Unity will override a system-wide .desktop file if you have one with the same name in your local directory so installing it with the same commands as you did for Nightly will work fine.

Postscript

I should probably add a disclaimer that I’ve used Unity for all of two days and there may be a smoother way to do this. I saw a couple of 3rd-party programs that will generate .desktop files but I didn’t want to install more things I’d rarely use. Please leave a comment if I’m way off on these instructions! 🙂

This post originally appeared on Wil’s blog.

5 comments on “Getting Firefox Nightly to stick to Ubuntu’s Unity Dock”

Post a comment

  1. Gerd Neumann wrote on

    It’s a pity that it’s much harder than it could be for early adopters/testers on Ubuntu. These two bugs are the main showstoppers for me:
    https://bugzilla.mozilla.org/show_bug.cgi?id=1255740
    https://bugzilla.mozilla.org/show_bug.cgi?id=1301670

    Reply

  2. Matthieu Faure wrote on

    Thank you for this post. It does not work on my station. I executed the desktop-file-validate and desktop-file-install, both went OK. But the nightly icon doesn’t appear (even after a lightdm restart or a reboot). I tried harvesting the lightdm log files but couldn’t find anything. Here is my desktop file (from .local/share/applications):

    [Desktop Entry]
    Version=1.0
    Name=Nightly
    Comment=Browse the World Wide Web
    Icon=/home/mfaure/opt/firefox-nightly/browser/icons/mozicon128.png
    Exec=/home/mfaure/opt/firefox-nightly/firefox %u
    Terminal=false
    Type=Application
    Categories=Network;WebBrowser;
    Actions=Default;ProfileManager;

    X-Desktop-File-Install-Version=0.22

    [Desktop Action Default]
    Name=Default Profile
    Exec=/home/mfaure/opt/firefox-nightly/firefox –no-remote

    [Desktop Action ProfileManager]
    Name=Profile Manager
    Exec=/home/mfaure/opt/firefox-nightly/firefox –no-remote –profile-manager

    Do you know a place I could look for clues ?

    Reply

  3. Gerd Nemann wrote on

    @Mattieu: Did not work for me either, following exactly the guide. Only after
    1. Running nightly manually
    2. then setting is as default browser
    3. clicking a link in Thunderbird
    only some the icon appeared in the sidebar, somehow by chance.

    Looks like this guide is, well, broken :-/

    Reply

  4. Gerd wrote on

    As others said, this guide is broken and it would be great if it could be updated to work again. For instance, since Firefox 59 (Nightly) upgrade I think that the icon path needs to be changed from
    >Icon=/opt/firefox/browser/icons/mozicon128.png
    to
    >Icon=/opt/firefox/browser/chrome/icons/default/default128.png

    Reply

  5. shuttingdown wrote on

    If somebody find this article, and need a newer/updated version ( for newer Firefox/Nightly ), search for the following article: Creating a Gnome Dock launcher and a terminal command for Firefox Nightly

    Reply

Leave a Reply

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