March 11, 2008

Using gmail as the default email on Ubuntu, done right!

If you're like me, you love gMail. If you could, you would marry it. I would anyway.. A big pet peeve of mine in Ubuntu has been when I click a mailto:// links, Evolution would open up instead of the system just somehow knowing that I use gMail and taking me there. As some of you know, I'm also in love with Gnome-Do, it's a messy love triangle but it's getting cleaner thanks to this script. This little hack allows you to use the built in Gnome-do Email function with gMail. I initially stole this from the How-to Geek, but it did not fit my needs exactly. I'm posting it here so that everyone can benefit from my changes. In its current state a la how-to geek, you need to decide if you want to open a new firefox window, or a tab, you cannot do both. I love tabs, and despise multiple instances of the same program running, however with How-to geek's method, if you don't have FF open, the script throws an error and will not open firefox and gMail for you. This script is my fix for that. For the complete how to, please head to http://www.howtogeek.com/howto/ubuntu/set-gmail-as-default-mail-client-in-ubuntu/. They've done a great job, and I don't see any point in duplicating their efforts, so use their howto, but substitute my script for theirs.
 #!/bin/bash  function gmailinFF  {    firefox -remote "openurl(https://mail.google.com/mail?view=cm&tf=0&to=`echo $1 | sed 's/mailto://'`,new-tab)"  } RUNNING=`ps -e |grep firefox`  if [ -z RUNNING ]  then    firefox &    sleep 2    gmailinFF $1  else    gmailinFF $1  fi
C'est tout! I hope this helps someone..

No comments: