MATTHEW

Tuesday, May 16, 2006

Using Gmail as GNOME’s default mailer (v1.1)

Update: I added a line to change subject= to su= in the Gmail URL. How dare they be different!

I started using Gmail as my primary mail application a little over a year ago. For the most part, it has been a pleasurable experience. However, to my knowledge there has not been a simple way to make Gmail your default mailer in GNOME. There are firefox extensions that implement this functionality, but I used epiphany and the functionality does not extend to the entire GNOME desktop.

Also check out version 1.0.

My latest shell script changes all this. I can’t take full credit. It is based apon a script by David L Norris entitled ymail. This simple hack changes the Yahoo URL to the proper Gmail one.

The script is easy to install. First copy the gnome-gmail script to /usr/bin and make sure it is world-executable. This can be accomplished with the commands sudo cp gnome-gmail /usr/bin and chmod 755 /usr/bin/gnome-gmail in Ubuntu. Next goto “System -> Preferences -> Preferred Applications” in your GNOME Menu. Once you are there, change the “Mail Reader” drop down box to “Custom.” In the command box enter gnome-gmail %s.

Setting your preferred mail reader

This script launches your preferred web browser using the preferred effect. (eg. new window or new tab) Anyway, here is the script:

#!/bin/sh

# gnome-gmail - a script that passes gnome mailto links to gmail in your browser
# Copyright (c) 2006 Matthew C Ruschmann <http://matthew.ruschmann.net>
# Version: 1.0

# Adapted from ymail - by David L Norris <dave@webaugur.com>
# http://webaugur.com/wares/files/ymail

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Library General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

# Ask GNOME for the web browser command.
BROWSER=`gconftool-2 --get '/desktop/gnome/url-handlers/http/command' | cut -f1 -d' ' `

# If no arguments just start gmail
if test -z "${*}"
  then
    ${BROWSER} "http://www.gmail.com"
    exit
fi

# Grab all command line parameters and strip mailto: if it exists.
TOMAIL=`echo "${*}" | sed -e 's/mailto://g'`
TOMAIL=`echo "$TOMAIL" | sed -e 's/?/\&/g'`
TOMAIL=`echo "$TOMAIL" | sed -e 's/&subject=/\&su=/g'`

# This is the URL Yahoo! Companion and Yahoo! Toolbar uses to send email:
TOURL="https://gmail.google.com/gmail?view=cm&cmid=0&fs=1&tearoff=1&to="

# Print out what we are about to do
echo ${BROWSER} "${TOURL}${TOMAIL}"

# Execute mail command
${BROWSER} "${TOURL}${TOMAIL}"

[ /Linux :: gnome-gmail-1.1.html @ 17:24 with writebacks ]

Friday, April 07, 2006

Ruby: Sleeping away message

At the end of the night, my favorite away message is becoming:

class Matthew < Person::Base
  belongs_to :sleep
  has_many :dreams

[ /Random :: ruby_away.html @ 20:08 with writebacks ]

Monday, April 03, 2006

Using Gmail as GNOME’s default mailer

I started using Gmail as my primary mail application a little over a year ago. For the most part, it has been a pleasurable experience. However, to my knowledge there has not been a simple way to make Gmail your default mailer in GNOME. There are firefox extensions that implement this functionality, but I used epiphany and the functionality does not extend to the entire GNOME desktop.

My latest shell script changes all this. I can’t take full credit. It is based apon a script by David L Norris entitled ymail. This simple hack changes the Yahoo URL to the proper Gmail one. Warning: Google has a tendency to change the functionality of this URL which could disable this script.

The script is easy to install. First copy the gnome-gmail script to /usr/bin and make sure it is world-executable. This can be accomplished with the commands sudo cp gnome-gmail /usr/bin and chmod 755 /usr/bin/gnome-gmail in Ubuntu. Next goto “System -> Preferences -> Preferred Applications” in your GNOME Menu. Once you are there, change the “Mail Reader” drop down box to “Custom.” In the command box enter gnome-gmail %s.

Setting your preferred mail reader

This script launches your preferred web browser using the preferred effect. (eg. new window or new tab) Anyway, here is the script:

#!/bin/sh

# gnome-gmail - a script that passes gnome mailto links to gmail in your browser
# Copyright (c) 2006 Matthew C Ruschmann <http://matthew.ruschmann.net>
# Version: 1.0

# Adapted from ymail - by David L Norris <dave@webaugur.com>
# http://webaugur.com/wares/files/ymail

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Library General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

# Grab all command line parameters and strip mailto: if it exists.
TOMAIL=`echo "${*}" | sed -e 's/mailto://g'`

# This you can use to compose mail in Gmail:
TOURL="https://gmail.google.com/gmail?view=cm&cmid=0&fs=1&tearoff=1&to="

# Ask GNOME for the web browser command.
BROWSER=`gconftool-2 --get '/desktop/gnome/url-handlers/http/command' | cut -f1 -d' ' `

# Print out what we are about to do
#echo ${BROWSER} "${TOURL}${TOMAIL}"

# Execute mail command
${BROWSER} "${TOURL}${TOMAIL}"

[ /Linux :: gnome-gmail-1.0.html @ 19:58 with writebacks ]

Thursday, March 30, 2006

Markdown IS a Blosxom plugin

FYI: If you are looking for a Markdown Blosxom plugin, then you should know that Markdown is a Blosxom plugin. You just have to remove the .pl extension for Blosxom to recognize it. Hence, I just copied it over along with “Smartypants” and am using this post to test them!

[ /Updates :: markdown.html @ 19:07 with writebacks ]

Welcome to my new Blog!

Isn’t this great? Even though the layout has only just begun, I am absolutely loving it. I may even switch Superpositioned over to a similar theme, or at least migrate a few design ideas over.

For the blog engine I am using Blosxom. I already miss the Markdown on my Typo blogs. I will have to find (or write) a plugin to incorporate this.

Hopefully the simplicity of Blosxom encourages me to post often.

[ /Updates :: newblog.html @ 18:59 with writebacks ]