Using Chrome or Chromium for Mailto Links in Ubuntu

I’ve just switched over to using Chromium as my default browser in Ubuntu. Why? Because why not? Also, my profile in Chrome was mysteriously devoured by an evil act of faulty Internet provision, forcing me to have to rebuild my profile (my saved passwords, most visited sites, etc – thankfully Chrome/Chromium will sync your favorites! That’s amazing! Anyways…). So, what better time to switch to Chromium? But then I had to make Chromium handle my mailto links as well.

Long ago, this helped me set gmail as the default, but in Firefox. When I switched to Chrome, I edited the script given there to use Chrome. And now, I’ve edited it to use Chromium. Here’s what you do…

1. Save one of the following scripts as a file somewhere that makes good sense. Mine is at ~/.open_mailto.sh

Using Chromium:

#!/bin/sh

chromium-browser "https://mail.google.com/mail?view=cm&tf=0&to=`echo $1 | sed 's/mailto://'`"

Using Chrome:

#!/bin/sh

/opt/google/chrome/google-chrome "https://mail.google.com/mail?view=cm&tf=0&to=`echo $1 | sed 's/mailto://'`"

2. Open up System -> Preferences -> Preferred Applications. In the Internet tab, set the Mail Reader to ‘Custom’ and put the pathname of the script in the command slot, followed by ‘%s’. For example, mine readsĀ /home/zach/.open_mailto.sh %s.

3. Click on all the mailto links you can find. Like this one: chuck@norris.com. My apologies if that’s a real address that I just told everybody to spam.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s