Making File -> Send Link use Firefox and GMail in Ubuntu Linux
When you use the File -> Send Link feature in your web browser on most systems, including Firefox in Ubuntu Linux, it will open the system email client, which by default is Evolution. I use Evolution for work email and Gmail for personal stuff, so I wanted this to open a Gmail compose panel instead.
I did a bit of quick searching and
found that a lot of people had posted Perl and/or bash scripts or
command lines which would do this for “mailto:” links but did not
work correctly for File -> Send Link, where it is conventional to
pre-populate the “subject” field with the web page name, and the
body of the message with the URL. So I shamelessly stole one of them and extended it :-)
Ubuntu makes this very easy to set ... under System -> Preferences -> Preferred Applications you can set the mail reader to Custom and paste in the command below – this is a bit messy but handles both “mailto” (with extended options) and “Send Link” ....
perl -MURI::Escape -e '$to= shift; if ($to =~ /^([^\?]+)\?(.*)$/){$to=$1;$args="&".$2;$args=~s/\&subject=/&su=/};$to =~ s/^mailto://i; exec("firefox","https://mail.google.com/mail/?view=cm&fs=1&tf=1&cmid=22&to=".URI::Escape::uri_escape($to).$args);' '%s'
Cheers
Dave