You are not logged in.

#1 2011-06-17 19:15:20

BaconPie
Member
Registered: 2010-08-11
Posts: 209

xdg-email opening Firefox not Thunderbird

When clicking mailto links in Google Chrome it opens up Firefox. This is because Chrome uses xdg-mail to open your preferred email client. How can I configure xdg-mail to open Thunderbird instead?

It seems like there should be such an obvious answer to this. The man page sends me here: http://portland.freedesktop.org/wiki/EmailConfig but I'm using dwm so these aren't really an option. Installing them (I can't even do this because I don't know the name of the 'preferred applications' program) seems like a silly work-around, surely they are just editing some variables in a file?

Also, I checked out the actual /usr/bin/xdg-email file and it seems to know about Thunderbird but if it can't detect your desktop environment then it seems to fall back on your default browser. Which explains why it's opening in Firefox.

I added:

export DE="xfce"
export BROWSER="google-chrome"

to my .bash_profile and now "mailto:" links in Chrome open a new window of Chrome. Probably because it's still falling back to the default browser because it can't find my DE.

I thought it'd be similar to xdg-open's ~/.local/share/applications/defaults.list.

Can anyone point me in the right direction? Why is this so difficult?

Last edited by BaconPie (2011-06-17 19:15:57)

Offline

#2 2011-07-12 19:12:28

gadget3000
Member
Registered: 2010-05-11
Posts: 18

Re: xdg-email opening Firefox not Thunderbird

xdg-open uses this command to detect the desktop environment and (I think) overwrites the DE variable:
$ xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$'
What is the output of that command?

xdg-open also executes exo-open to open links when you use xfce. What happens when you do:
$ exo-open <AMailtoLink>

Last edited by gadget3000 (2011-07-13 07:02:20)

Offline

#3 2012-09-11 08:53:50

Awebb
Member
Registered: 2010-05-06
Posts: 4,317

Re: xdg-email opening Firefox not Thunderbird

Since I found this thread on google with the very generic "set xdg-email" as fourth hit, I shamelessly necrobump it with further information, since the exact same problem still persists.

I somewhat solved this, by inspecting the scripts /usr/bin/xdg-open and /usr/bin/xdg-email. They both refer to an application called "x-www-browser". I don't know what made them drop the XDG_MAILER variable, if $BROWSER is the only possible variable, then the whole application is relatively useless in most modern scenarios. However, I kind of solved this, by symlinking /usr/bin/xdg-open to /usr/local/bin/x-www-browser. Since xdg-open does all the URI handling (in my and oviously OP's case), this might be a sane default.

EDIT: Okay, this was maybe not the greatest idea. Anything causing xdg-open to call x-www-browser might end up summoning ALL the x-www-browser processes, spawning process after process, filling RAM and swap. Excercise extreme caution.

Last edited by Awebb (2012-09-11 14:23:31)

Offline

#4 2014-05-28 06:29:14

octref
Member
From: BK-201
Registered: 2014-04-18
Posts: 13

Re: xdg-email opening Firefox not Thunderbird

I also had this issue and found a fix.

Open /usr/bin/xdg-email and find the function "detectDE". Make sure it sets DE="gnome3". If you have multiple DEs just add a default case to the switch commands. If you only have one DE you can just add DE="gnome3" to the end of that function.

Explanation:
Chrome seems to use xdg-email. xdg-email has the function "detectDE".
detectDE tries to figure out what DE you are using, and then uses different methods to open the default mailer in different DE. If you are like me who's not using any DE, it'll likely fallback to a generic method which opens mailto links using $BROWSER. You don't want that.
Depending on the DE xdg-email calls one of [open_kde, open_gnome3, open_gnome, open_xfce]. I found open_gnome3 suits my need since it uses

xdg-mime query default "x-scheme-handler/mailto"

to determine the mailer, so I can just edit .local/share/applications/mimeapps.list to change my mailer in the future.
To make sure xdg-email uses open_gnome3, the DE needs to be set to "gnome3". You can of cousrse do that in your .bashrc or .zshrc, but I guess not using gnome and set the DE variable to it is a bad choice.


上善若水。

Offline

#5 2014-05-28 15:50:42

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 12,943

Re: xdg-email opening Firefox not Thunderbird

Closing this old thread


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Like you, I have no idea what you are doing, but I am pretty sure it is wrong...Jasonwryan
----
How to Ask Questions the Smart Way

Offline

Board footer

Powered by FluxBB