I have set up Chrome (my primary browser) to use gmail when I click an email link. However, when I right-click a file on the desktop and select "New Email with Attachment" OS X launches Mail.app. Is there a way to make it open a gmail compose window tab in my browser instead?
The New Email with Attachment service is a feature of Mail. It is built into Mail, and Mail provides it as a service to other applications.
I wonder if you could use this but modify it to point to the code written below (the method you are using to make this work in Chrome)?
There are different instructions for different browsers here.
As an example, this is for Chrome and Opera:
and a bit of clarification from further down the page...
Accept the confirmation at the top of the browser window and try out a mailto link
Check out the link though if you're using a different browser.