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 Actions 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:

  1. 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.
  2. 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.

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! :)

Signing your commits on GitHub with a GPG key

Every time Chuck Harmston commits to GitHub he has that fancy [verified] tag next to his name and I'm super jealous.

I've been too lazy to add GPG signing to my Git commits because it seemed like too much work, but I had some free time this afternoon and Julien Vehent convinced me it wasn't that hard, so, here we are. Writing this post is partly to encourage everyone to sign their commits, and partly so I can find these steps again when I forget how to do it in the future.

I already have a gpg key I use for Mozilla things, so I'll start with that. Check out your current keys (if this list is empty, you'll need to make a key):

$ gpg --list-keys wclouser@mozilla.com
pub   4096R/4A403229 2013-08-19
uid                  Wil Clouser <wclouser@mozilla.com>
sub   4096R/B438E342 2013-08-19

I want to use a new subkey for GitHub signing, so I'll edit my existing master key and add a new one:

gpg --edit-key 4A403229
gpg> addkey
<I choose to add a 4096 bit RSA signing-only key which expires in two years>
gpg> save

Reviewing my new key:

$ gpg --list-keys wclouser@mozilla.com
pub   4096R/4A403229 2013-08-19
 uid                  Wil Clouser <wclouser@mozilla.com>
sub   4096R/B438E342 2013-08-19
sub   4096R/04D1111C 2016-08-30 [expires: 2018-08-30]

Adding the key to GitHub

Telling GitHub about the key is pretty straight forward. Firstly, get your public key:

$ gpg --armor --export 04D1111C
-----BEGIN PGP PUBLIC KEY BLOCK-----
  ...
  <many lines of text here>
  ...
-----END PGP PUBLIC KEY BLOCK-----

Next, load https://github.com/settings/keys and click New GPG Key. Then copy and paste the entire output from the command you ran above into the textarea on that page and click save.

Signing the commit

You're going to sign all your commits, right? So let's just add this thing globally (bonus note: you can add this, but it only works in git 2.0 and above. If you have an old version you'll need to add the -S flag to your git commit commands):

$ git config --global commit.gpgsign true

If you have more than one key you'll want to specify the key to use:

$ git config --global user.signingKey 04D1111C

You can change all this stuff in ~/.gitconfig if you'd rather adjust it directly. While you're in there, double check that the user.email value lines up with the email address assigned to your key and the email address that GitHub knows about or else you'll have a mismatch when you try to use it.

Ready to commit something? Edit your files like normal, and git commit. You'll be prompted for your GPG password (unless you use an agent, and you should) and everything else should just work like normal. Github will recognize the signed commit:

Transferring the key to your laptop

Transferring secret keys around always raises some eyebrows, but the reality is many of us make commits from multiple computers. As long as you protect the key in transit, this should be relatively secure. Firstly, export it into a couple of files:

gpg --export 04D1111C > key-pub.asc
gpg --export-secret-keys 04D1111C > key-sec.asc

Then securely transfer those files to your laptop (scp is a good choice) and run:

gpg --import key-pub.asc
gpg --import key-sec.asc

When you're done, securely delete the .asc files on both computers (I use shred but there are other options).

And that's it. Signed commits!

It's time to upgrade from Test Pilot to Test Pilot

Were you one of the brave pioneers who participated in the original Test Pilot program? You deserve a hearty thanks!

Are you also someone who never bothered to uninstall the old Test Pilot add-on which has been sitting around in your browser ever since? Or maybe you were hoping the program would be revived and another experiment would appear? Or maybe you forgot all about it?

If that's you, I've got news: I'm releasing an upgrade for the old Test Pilot add-on today which will:

  • Open a new tab inviting you to join the new Test Pilot program
  • Uninstall itself and all related settings and data

If you're interested in joining the new program, please click through and install the new add-on when you're prompted. If you're not interested, just close the tab and be happy your browser has one less add-on it needs to load every time you start it up.

Random FAQs:

  • The old add-on is, well, old, so it can only be uninstalled after you restart Firefox. It's all automatic when you do, but if you're waiting for a prompt and don't see it, that could be the culprit.

  • If you already have the new Test Pilot add-on installed, you can just close the new tab. The old add-on will be uninstalled and your existing Test Pilot add-on (and any experiments you have running) will be unaffected.

A special thanks to Philipp Kewisch and Andreas Wagner for their help writing and reviewing the add-on.

Test Pilot launches today!

Check out Test Pilot or read the official announcement.

I joined the Test Pilot team in January and am pleased to be a part of launching our experiment platform today on testpilot.firefox.com! Our goal is to provide a portal where you can easily browse and play with experimental features in Firefox.

We're starting out with three new experiments so people can get a feel for what the program is like and we'll be rotating new experiments in as previous ones graduate from the program.

Behind the scenes is a pretty comprehensive pipeline to rocket an idea from the back of a napkin to being used by users in a short period of time. If you have an idea (bonus points if it's already an add-on) and would like to get in the program let us know, look us up in #testpilot on irc.mozilla.org, or get in touch with me directly.

Replace emojis with :aliases: on IRC

I work with some cool cats who are on the cutting edge of hip new technologies like emojis. OS X shows the emojis correctly but if I'm using IRC over SSH from Linux all I see are missing characters:

Are they ready to push the site? I always just assume so, but before that comes back to bite me I decided to write a quick script to replace emojis with their text aliases:

On the left is their view, and on the right is my client that is still stuck in two-thousand-late.

If you run weechat and would like to use the script:

  1. Copy emoji2alias.py to ~/.weechat/python
  2. Run /python load emoji2alias.py

If you want it to load automatically:

  1. cd ~/.weechat/python/autoload
  2. ln -s ../emoji2alias.py .