You are not logged in.

#1 2014-06-08 06:46:27

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

[workaround] Clicking on a mailto email opens Firefox & Thunderbird

Hi there,

I set Thunderbird as my default email client.

However, for some strange reason, clicking on a mailto:email@domain.com link opens both, a new Firefox instance and the Thunderbird compose window.

Can anyone give me a hint why Firefox is opened in addition to Thunderbird?

Does someone have the same issue?

Thank you!

Last edited by orschiro (2014-06-11 06:30:59)

Offline

#2 2014-06-09 00:42:25

root
Member
From: 127.0.0.1
Registered: 2012-04-13
Posts: 297

Re: [workaround] Clicking on a mailto email opens Firefox & Thunderbird

My humble guess would be that before setting Thunderbird as your default email client the system already had Firefox "set" as the application for handling mailto content.

Therefore once you click on this type of content the system runs your preference and its "default". If I remember correctly I had a similar issue with Chromium where the download directories/folders wouldn't open just with my file manager but firefox(?) was also started.

I would suggest to take a look at your mimeapps.list and check the association for that action or add it if it is missing  with

x-scheme-handler/mailto=desiredapp.desktop

in the 'Default Applications' section. For further details on this check 'Default Applications' in the Wiki.

*HINT*: check the .desktop name before adding it to the mimeapps.list file as f.e. thunar.desktop does not exist but Thunar.desktop does.

Last edited by root (2014-06-09 00:43:17)


\(o_X)/
                        'Cause I wanna be an Archy - An Archy in the UK // Sex Pistols

Offline

#3 2014-06-09 06:28:06

dodo3773
Member
Registered: 2011-03-17
Posts: 814

Re: [workaround] Clicking on a mailto email opens Firefox & Thunderbird

Assuming you are using "xdg-utils" for this stuff (xdg-open xdg-email etc...)

Which window manager / desktop environment are you using? In my .zprofile I have this since I run openbox:

export DE="gnome"

Probably a better place for that but it works right for me (maybe you could put it in an environment file somewhere). What happens if you "echo $DE" in a terminal?

Here is what I have in my mime files:

~/.local/share/applications/defaults.list

x-scheme-handler/mailto=thunderbird.desktop
application/mbox=thunderbird.desktop
message/rfc822=thunderbird.desktop

and

~/.local/share/applications/mimeapps.list

x-scheme-handler/mailto=userapp-Thunderbird-XV1WVW.desktop
application/mbox=thunderbird.desktop
message/rfc822=userapp-Thunderbird-XV1WVW.desktop
application/x-extension-eml=userapp-Thunderbird-XV1WVW.desktop
x-scheme-handler/mailto=exo-mail-reader.desktop;evolution.desktop;userapp-Thunderbird-XV1WVW.desktop;
message/rfc822=userapp-Thunderbird-XV1WVW.desktop;
application/x-extension-eml=userapp-Thunderbird-XV1WVW.desktop;

Hope that helps. I remember this was a major annoyance for me at one time.

Offline

#4 2014-06-10 05:12:12

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: [workaround] Clicking on a mailto email opens Firefox & Thunderbird

Thanks a lot for your tips!

Indeed I have xdg-utils installed:

xdg-utils 1.1.0.git20140207-1

Furthermore I use Openbox with DE exported to Gnome:

~ echo $DE
gnome

I would say that my mimeapps.list and defaults.list both contain all relevant entries but still Firefox is opened next to Thunderbird. sad

~ cat ~/.local/share/applications/mimeapps.list | grep Thunderbird 
x-scheme-handler/mailto=userapp-Thunderbird-CNVK6W.desktop
message/rfc822=userapp-Thunderbird-CNVK6W.desktop
application/x-extension-eml=userapp-Thunderbird-CNVK6W.desktop
x-scheme-handler/news=userapp-Thunderbird-CNVK6W.desktop
x-scheme-handler/feed=userapp-Thunderbird-CNVK6W.desktop
application/rss+xml=userapp-Thunderbird-CNVK6W.desktop
application/x-extension-rss=userapp-Thunderbird-CNVK6W.desktop
x-scheme-handler/snews=userapp-Thunderbird-SMA1EX.desktop
x-scheme-handler/nntp=userapp-Thunderbird-SMA1EX.desktop
x-scheme-handler/mailto=userapp-Thunderbird-E8OLUW.desktop;userapp-Thunderbird-CNVK6W.desktop;userapp-Daily-9DTQEX.desktop;userapp-Thunderbird-SMA1EX.desktop;
message/rfc822=userapp-Thunderbird-E8OLUW.desktop;userapp-Thunderbird-QCCU4W.desktop;userapp-Thunderbird-CNVK6W.desktop;userapp-Daily-9DTQEX.desktop;userapp-Thunderbird-SMA1EX.desktop;
application/x-extension-eml=userapp-Thunderbird-E8OLUW.desktop;userapp-Thunderbird-QCCU4W.desktop;userapp-Thunderbird-CNVK6W.desktop;userapp-Daily-9DTQEX.desktop;userapp-Thunderbird-SMA1EX.desktop;
x-scheme-handler/news=userapp-Thunderbird-E8OLUW.desktop;userapp-Thunderbird-CNVK6W.desktop;userapp-Daily-9DTQEX.desktop;userapp-Thunderbird-SMA1EX.desktop;
x-scheme-handler/feed=userapp-Thunderbird-E8OLUW.desktop;userapp-Thunderbird-CNVK6W.desktop;userapp-Daily-9DTQEX.desktop;userapp-Thunderbird-SMA1EX.desktop;
application/rss+xml=userapp-Thunderbird-E8OLUW.desktop;userapp-Thunderbird-CNVK6W.desktop;userapp-Daily-9DTQEX.desktop;userapp-Thunderbird-SMA1EX.desktop;
application/x-extension-rss=userapp-Thunderbird-E8OLUW.desktop;userapp-Thunderbird-CNVK6W.desktop;userapp-Daily-9DTQEX.desktop;userapp-Thunderbird-SMA1EX.desktop;
x-scheme-handler/snews=userapp-Daily-9DTQEX.desktop;userapp-Thunderbird-SMA1EX.desktop;
x-scheme-handler/nntp=userapp-Daily-9DTQEX.desktop;userapp-Thunderbird-SMA1EX.desktop;
~ cat ~/.local/share/applications/defaults.list                   
x-scheme-handler/mailto=thunderbird.desktop
application/mbox=thunderbird.desktop
message/rfc822=thunderbird.desktop
~ l /usr/share/applications/thunderbird.desktop 
-rw-r--r-- 1 root root 293 2014-04-29 11:21:12.000000000 +0200 /usr/share/applications/thunderbird.desktop

Any other ideas?

Offline

#5 2014-06-10 05:50:04

dodo3773
Member
Registered: 2011-03-17
Posts: 814

Re: [workaround] Clicking on a mailto email opens Firefox & Thunderbird

When you said "I set Thunderbird as my default email client." did you mean on the system or in Firefox preferences Applications tab or both?

Offline

#6 2014-06-10 06:11:29

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: [workaround] Clicking on a mailto email opens Firefox & Thunderbird

Crucial hint! I think I now know what the issue is.

Firefox is opened because it is seen as the default browser probably?

So, clicking on a mailto link open this Firefox window.

This corresponds to the issue that my Chromium browser, that I want to have as default, tells me in its settings:

Default browser: Chromium cannot determine or set the default browser.

Offline

#7 2014-06-10 06:31:00

dodo3773
Member
Registered: 2011-03-17
Posts: 814

Re: [workaround] Clicking on a mailto email opens Firefox & Thunderbird

I've gotten that chromium message before too. Still set default mailto to thunderbird. What happens if you open a terminal and do something like this?:

xdg-email foo@bar.com

Also, by firefox settings I mean in Preferences -> Applications. Should look something like this (notice the mailto):

https://i.imgur.com/bMk01YJ.png


Edit: Also check this out maybe it will help(the section about setting a string in about:config)?

http://kb.mozillazine.org/Default_mail_ … x_in_Linux

Last edited by dodo3773 (2014-06-10 06:32:37)

Offline

#8 2014-06-10 06:46:44

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: [workaround] Clicking on a mailto email opens Firefox & Thunderbird

~ xdg-email foo@bar.com
/usr/bin/xdg-email: line 691: x-www-browser: command not found

(process:12554): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed
Fail: [Exception... "Component returned failure code: 0x80520012 (NS_ERROR_FILE_NOT_FOUND) [nsIXPCComponents_Utils.import]"  nsresult: "0x80520012 (NS_ERROR_FILE_NOT_FOUND)"  location: "JS frame :: resource://fvd.sync.modules/sync.js :: fvd_sync_Sync_Class/loadDrivers/< :: line 197"  data: no]
IGNORE: 4, 526, 530, 1

This opens again a Firefox. I set the Firefox preferences the same way as you do. Thunderbird is set default.

Offline

#9 2014-06-10 06:54:20

dodo3773
Member
Registered: 2011-03-17
Posts: 814

Re: [workaround] Clicking on a mailto email opens Firefox & Thunderbird

Okay, when I change to DE=generic in my shell it opens a web browser for me too (probably because I have BROWSER="/usr/bin/chromium") in my .xinitrc. Where are you exporting DE=gnome at? I think we may be on the right track. Also, if you "DE=gnome xdg-email foo@bar.com" does it work from a shell?

Edit: xdg-email is a script by the way and the function it is calling is open_generic and not open_gnome from the error message you posted. You can open it and check out that line (hack it yourself (bad idea though it will get rewritten upon update)) if you wanted too.

Last edited by dodo3773 (2014-06-10 06:57:23)

Offline

#10 2014-06-10 06:58:43

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: [workaround] Clicking on a mailto email opens Firefox & Thunderbird

I have the following entries in my .xinitrc:

export DESKTOP_SESSION=gnome
export DE=gnome
export BROWSER=chromium

Your last command suggestion also again opens Firefox...

 DE=gnome xdg-email foo@bar.com
/usr/bin/xdg-email: line 691: x-www-browser: command not found

(process:13952): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed
Fail: [Exception... "Component returned failure code: 0x80520012 (NS_ERROR_FILE_NOT_FOUND) [nsIXPCComponents_Utils.import]"  nsresult: "0x80520012 (NS_ERROR_FILE_NOT_FOUND)"  location: "JS frame :: resource://fvd.sync.modules/sync.js :: fvd_sync_Sync_Class/loadDrivers/< :: line 197"  data: no]
IGNORE: 4, 526, 530, 1

Offline

#11 2014-06-10 07:04:11

dodo3773
Member
Registered: 2011-03-17
Posts: 814

Re: [workaround] Clicking on a mailto email opens Firefox & Thunderbird

In "~/.local/share/applications/mimeapps.list" do you have "x-www-browser=" something? Not sure why that would affect this but maybe that is why that error is popping up. Mine says "x-www-browser=chromium.desktop"

Edit: Do you have "libgnome" package installed? I do and it is in optional deps for xdg-utils

Edit2: Would make a lot of sense since gnome-open function calls on "/usr/bin/gnome-open" and gnome-open is provided by libgnome package

Last edited by dodo3773 (2014-06-10 07:20:24)

Offline

#12 2014-06-10 08:12:15

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: [workaround] Clicking on a mailto email opens Firefox & Thunderbird

I really don't understand this issue.

~ cat ~/.local/share/applications/mimeapps.list | grep x-www
x-www-browser=chromium.desktop

libgnome is also installed. Why the heck is xdg-email complaining that it cannot find x-www-browser.

~  DE=gnome xdg-email foo@bar.com
/usr/bin/xdg-email: line 691: x-www-browser: command not found

Offline

#13 2014-06-10 18:57:00

dodo3773
Member
Registered: 2011-03-17
Posts: 814

Re: [workaround] Clicking on a mailto email opens Firefox & Thunderbird

Well, just go into /usr/bin/xdg-email and rename line 644 to "open_generic()" and line 681 to "open_gnome()" and test that.

Offline

#14 2014-06-10 22:47:29

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: [workaround] Clicking on a mailto email opens Firefox & Thunderbird

dodo3773 wrote:

Well, just go into /usr/bin/xdg-email and rename line 644 to "open_generic()" and line 681 to "open_gnome()" and test that.

Wow, finally works!

I am wondering, is this actually a bug? This modification will be overwritten on every update. Is there no other *proper* solution to this other than this hack?

Offline

#15 2014-06-10 23:19:17

dodo3773
Member
Registered: 2011-03-17
Posts: 814

Re: [workaround] Clicking on a mailto email opens Firefox & Thunderbird

Okay revert the changes and remove DE and DESKTOP_ENVIRONMENT variables from. xinitrc Then instead try putting them in different files. Thinking maybe ~/.profile or ~/.config/openbox/environment or /etc/environment etc.. Also, I would look into your display manager if you want using one of those too. I just go tty->zsh->startx so that's why I use ~/.zprofile if you do something similar with bash it may be .bash_profile. But I think the problem may be using xinitrc. Just my guess

Offline

#16 2014-06-11 05:37:30

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: [workaround] Clicking on a mailto email opens Firefox & Thunderbird

@dodo3773

I use exactly the same setup consisting of Openbox, startx & zsh.

Mind sharing your relevant profile files and xinitrc?

Thanks ahead!

Offline

#17 2014-06-11 05:44:03

dodo3773
Member
Registered: 2011-03-17
Posts: 814

Re: [workaround] Clicking on a mailto email opens Firefox & Thunderbird

Yeah no problem.
~/.xinitrc

#!/bin/sh


if [ -d /etc/X11/xinit/xinitrc.d ]; then
  for f in /etc/X11/xinit/xinitrc.d/*; do
    [ -x "$f" ] && . "$f"
  done
  unset f
fi

export BROWSER="/usr/bin/chromium"

eval $(/usr/bin/gnome-keyring-daemon --start --components=gpg,pkcs11,secrets,ssh)

export SSH_AUTH_SOCK
export GPG_AGENT_INFO
export GNOME_KEYRING_CONTROL
export GNOME_KEYRING_PID

exec openbox-session

~/.zprofile

export QT_STYLE_OVERRIDE=gtk

export DE="gnome"

[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && startx &> ~/.xlog
[[ -z $TMUX && -z $DISPLAY && $XDG_VTNR -eq 2 ]] && ( tmux attach || tmux new-session -s tty2 )

~/.config/openbox/environment

eval $(gpg-agent --daemon)
eval $(gnome-keyring-daemon)
if which dbus-launch >/dev/null && test -z "$DBUS_SESSION_BUS_ADDRESS"; then
       eval `dbus-launch --sh-syntax --exit-with-session`
       fi

Some of this stuff is probably redundant (the eval gnome keyring). But that is pretty much my environment startup stuff and .xinitrc stuff in a nutshell besides systemd login to tty file(s).

Offline

#18 2014-06-11 06:30:37

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: [workaround] Clicking on a mailto email opens Firefox & Thunderbird

Weird, using exactly the same settings still does require me to patch xdg-email.

Whatever, I created a patched package in the AUR, called xdg-utils-xdg-email-gnome.

Perhaps it is also useful to other people!

Thanks for your guidance. Marking this as [workaround].

Offline

#19 2014-06-11 06:44:58

dodo3773
Member
Registered: 2011-03-17
Posts: 814

Re: [workaround] Clicking on a mailto email opens Firefox & Thunderbird

Well, it's an ugly hack but it works I guess haha. May want to move libgnome to the depends instead of optdepends. Just a thought. Or maybe like a message that says hey if you use anything but kde and xfce then install libgnome etc..

Offline

#20 2014-06-11 07:02:30

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: [workaround] Clicking on a mailto email opens Firefox & Thunderbird

Good suggestion!

Moved libgnome to depends in -2.

Thanks!

Offline

#21 2014-06-11 07:08:44

dodo3773
Member
Registered: 2011-03-17
Posts: 814

Re: [workaround] Clicking on a mailto email opens Firefox & Thunderbird

Yeah makes sense.

Thinking about it a little more: Why does open_generic open a web browser in the first place? If someone doesn't run gnome, kde or xfce then they don't use an email client? What kind of reasoning is that anyways?

Here is another thing I just tested that also will open thunderbird:

export DE=generic
export BROWSER=thunderbird
xdg-email foo@bar.com

This has all got me pretty curious. I think I am going to write an email to the people who's emails are listed in xdg-email.in .... done. We'll see what they say if they write back.

Offline

#22 2014-06-11 11:12:22

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: [workaround] Clicking on a mailto email opens Firefox & Thunderbird

Interesting. Indeed ridiculous to treat Thunderbird as a web browser!

Keep us please posted about what they say on the mailing list.

Offline

#23 2014-06-11 20:48:19

dodo3773
Member
Registered: 2011-03-17
Posts: 814

Re: [workaround] Clicking on a mailto email opens Firefox & Thunderbird

Okay. I got one response but the guy said he wasn't working on that project anymore so whatever. Here is a working open_generic function that doesn't rely on gvfs or libgnome and uses the current script internals. Maybe it would be good just to fork this project to github or request a merge after a few people look at it. Let me know if it works for you.

open_generic()
{
	    local client
    local desktop
    desktop=`xdg-mime query default "x-scheme-handler/mailto"`
    client=`desktop_file_to_binary "$desktop"`
    echo $client | grep thunderbird > /dev/null 2>&1
    if [ $? -eq 0 ] ; then
        run_thunderbird "$client" "$1"
    fi

    if [ $? -eq 0 ]; then
        exit_success
    else
    
    IFS=":"
    for browser in $BROWSER; do
        if [ x"$browser" != x"" ]; then

            browser_with_arg=`printf "$browser" "$1" 2>/dev/null`
            if [ $? -ne 0 ]; then browser_with_arg=$browser;
            fi

            if [ x"$browser_with_arg" = x"$browser" ]; then "$browser" "$1";
            else $browser_with_arg;
            fi

            if [ $? -eq 0 ]; then exit_success;
            fi
        fi
    done

    exit_failure_operation_impossible "no method available for opening '$1'"
    fi
}

Still has the fallback browser stuff in there. Let me know.

Edit: Filed a bug on freedesktop. We'll see what happens.

Last edited by dodo3773 (2014-06-12 05:23:33)

Offline

#24 2014-06-12 10:50:08

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: [workaround] Clicking on a mailto email opens Firefox & Thunderbird

@dodo3773

Reinstalled the default xdg-utils package and replaced the open_generic function in /usr/bin/xdg-email with your proposed patch. Yes, it works!

I hope that the guys at freedesktop pick up your patch.

Thanks!

Offline

#25 2014-06-12 19:05:22

dodo3773
Member
Registered: 2011-03-17
Posts: 814

Re: [workaround] Clicking on a mailto email opens Firefox & Thunderbird

Bug has been assigned. Got a positive comment so far.

https://bugs.freedesktop.org/show_bug.cgi?id=79929

Not really sure how the review process goes but hopefully it (or something similar) will get merged.

Offline

Board footer

Powered by FluxBB