Chrome opens mailto: links wrongly

Bug #1063801 reported by Xiong Changnian
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Linux Mint
Won't Fix
Undecided
Unassigned

Bug Description

Setup:

Linux Mint 13
Linux 3.2.0-31-generic
MATE 1.4.0
Chrome 22.0.1229.79
Thunderbird 15.0
xdg-utils 1.1.0~rc1-2ubuntu6

Observed:

Clicking a mailto: link in Chrome does three things in this order:

(1) Chrome opens a new window with a new New Tab tab;

(2) Firefox opens with a new window containing a single blank tab; and

(3) Thunderbird opens a new Compose window, properly populated from the link.

Of these, of course only (3) is desired. If the action is repeated without first closing Firefox then modify (2) to open only a new tab in the existing window; this tab is identified as attempting to open the mailto: link.

Chrome is set as default browser and Thunderbird as default email client in:
System > Preferences > Preferred Applications

Explanation: The xdg-utils suite of tools does not seem properly to recognize MATE.

Workaround: Patch /usr/bin/xdg-email:

--- /home/xiong/Desktop/xdg/original/xdg-email
+++ /home/xiong/Desktop/xdg/patched/xdg-email
@@ -378,6 +378,7 @@
     elif [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde;
     elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome;
     elif `dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.GetNameOwner string:org.gnome.SessionManager > /dev/null 2>&1` ; then DE=gnome;
+ elif [ x"$MATE_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome;
     elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/null 2>&1; then DE=xfce;
     elif [ x"$DESKTOP_SESSION" = x"LXDE" ]; then DE=lxde;
     elif [ x"$XDG_CURRENT_DESKTOP" = x"LXDE" ]; then DE=lxde;

Result: This induces the desired behavior exactly.

Note: Suspect all scripts included in xdg-utils should be similarly patched.

Revision history for this message
Xiong Changnian (xiong-cpan) wrote :
Revision history for this message
Ongytenes (ongytenes) wrote :

I found that if I ran xdg-email from the command line, it would load Chromium instead of Thunderbird. I checked xdg-mime and saw that Thunderbird was my default mail client.

I then looked at the xdg-email script and determined that the script only has code to recognize common desktops like KDE and Gnome. It does this by looking at the environment variables by using the following script. The mail client usage is influenced by what desktop is being used.

detectDE()
{
    if [ x"$MAILER" != x"" ]; then DE=envvar;
    elif [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde;
    elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome;
    elif `dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.GetNameOwner string:org.gnome.SessionManager > /dev/null 2>&1` ; then DE=gnome;
    elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/null 2>&1; then DE=xfce;
    elif [ x"$DESKTOP_SESSION" = x"LXDE" ]; then DE=lxde;
    elif [ x"$XDG_CURRENT_DESKTOP" = x"LXDE" ]; then DE=lxde;
    elif [ -r ~/.muttrc ] && which mutt > /dev/null 2>&1; then
 DE=envvar
 MAILER="x-terminal-emulator -e mutt"
    else DE=""
    fi
    DEBUG 2 "DE is \"$DE\""
}

So I did an experiment, I added the following one line to xdg-email.
    elif [ x"MATE_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome;

First I ran xdg-email with an email address from the command line and Thunderbird was loaded with the address.
Then I tried clicking a link in Chrome and it opened Thunderbird with the address.

I believe a better fix would involve writing a whole procedure just for Mate in the xdg-email instead of pointing it to the gnome procedure.

Revision history for this message
Michael Tanner (thonixx) wrote :

Many thanks for the fix, I confirm it works like a charm.

Revision history for this message
adamski (adam-hasselbalch) wrote :

This is still present in Linux Mint 17

Changed in linuxmint:
status: New → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.