xdg-open is not mate compatible

Bug #1001902 reported by Leo on 2012-05-20
90
This bug affects 19 people
Affects Status Importance Assigned to Milestone
Ubuntu MATE
Medium
Unassigned
Xdg-utils
Fix Released
Unknown
xdg-utils (Ubuntu)
Undecided
Unassigned

Bug Description

I had to modify /usr/bin/xdg-open to duplicate the gnome parts and replace /gnome/mate/. Some applications like chrome/chromium open their file using xdg-open.

Linux Mint 13 RC mate edition

Related branches

Robert Evans (robert-evans) wrote :

In fact, none of the xdg-utils scripts work with Mate. Generally they should treat Mate as GNOME, but they fail to recognise it.
There's a detectDE function which checks for GNOME...
    elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome;
but is should also check for Mate ...
    elif [ x"$MATE_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome;
That will make the xdg-utils treat Mate as GNOME.

To be more rigorous, use
    elif [ x"$MATE_DESKTOP_SESSION_ID" != x"" ]; then DE=mate;
That allows xgd-utils scripts to contain functions for Mate separately.

These scripts contain detectDE
xdg-desktop-icon, xdg-desktop-menu, xdg-email, xdg-icon-resource, xdg-mime, xdg-open, xdg-screensaver, xdg-settings
but only
xdg-email, xdg-mime, xdg-open, xdg-screensaver and xdg-settings use it to determine which routines to call.

This bug is pretty fundamental to Mint. For example, mintwelcome uses xdg-open to call the browser to display its
links. If xdg-open doesn't work properly, mintwelcome launches chrome but won't close and stays in focus hiding the
help page you've just launched. With amended xdg-utils, mintwelcome launces firefox or chrome as appropriate and
"Close" works properly.

I'm attaching patches which seem to work. But I'm not sure that I've understood what xdg-screensaver is supposed todo and xdg-settings just uses the GNOME functions.

Rob Gardner (robmatic) wrote :

> To be more rigorous, use
> elif [ x"$MATE_DESKTOP_SESSION_ID" != x"" ]; then DE=mate;

Trouble with that is that the case statement following the call to detectDE doesn't have a case for mate, so it falls into the "unknown desktop environment" case.

Robert Evans (robert-evans) wrote :

Perhaps I should have said "...That allows xgd-utils scripts to contain functions (which you will need to code yourself) for Mate separately."!

Rob Gardner (robmatic) wrote :

Well, it looks like the linuxmint/mate guys picked up your suggestion to set DE=mate but didn't take it any further. The result is that my new lmde system gives me this:

rob $ xdg-settings get default-web-browser
xdg-settings: unknown desktop environment

Perhaps could you add some appropriate person to this bug's notification list?

Robert Evans (robert-evans) wrote :

That surprises me. What version of xdg-utils are you installing? I get
 xdg-utils Version: 1.1.0~rc1-2ubuntu6
if I apt-get from the standard Mint repository, and that version contains no Mate amendments at all.

But the "unoffical patch" I attached to my initial comment contained the required Mate routines.

(If I knew how to submit these things properly, I would.)

I'm attaching a tar of amended scripts. If you're adept at building your own deb files, you can use these to create a new xdg-utils deb file until an official version is produced. Alternatively, just place the scripts in /usr/bin.

Rob Gardner (robmatic) wrote :

My xdg-utils is:
  Version: 1.1.0~rc1+git20111210-6
Note that I am running LMDE, which may account for the differing version?

Anyhow, I see that you've got a statement in detectDE that sets DE=gnome if mate is detected, which is pretty much the same thing I did to fix my version. So it sounds like you've got this covered, and the only question is why did my mint install come with a broken version of xdg-settings, and can I expect a future update to fix this, or will I have to manually fix it with each update? :-(

In any case, thank you for your efforts and responses.

malheum (maxheise) wrote :

Hello,

I ran across this problem too when I tried to open a bittorrent magnet link from google chrome. I expected the magnet link to open in transmission-gtk, which did not happen.

I read the a nice description of the problem here http://askubuntu.com/questions/108925/how-to-tell-chrome-what-to-do-with-a-magnet-link.

And then added this little bit of code to /usr/bin/xdg-open. Basically I added a entry for mate in the finally case statement in xdg-open and then copied the gnome open_gnome to open_mate and changed the line open_gnome to open_mate. Patch made with diff -u attached.

case "$DE" in
    mate)
    open_mate "$url"
    ;;

    kde)
    open_kde "$url"
    ;;

    gnome)
    open_gnome "$url"
    ;;

    xfce)
    open_xfce "$url"
    ;;

    lxde)
    open_lxde "$url"
    ;;

    generic)
    open_generic "$url"
    ;;

    *)
    exit_failure_operation_impossible "no method available for opening '$url'"
    ;;
esac

open_mate()
{
    if gvfs-open --help 2>/dev/null 1>&2; then
        gvfs-open "$1"
    else
        mate-open "$1"
    fi

    if [ $? -eq 0 ]; then
        exit_success
    else
        exit_failure_operation_failed
    fi
}

BR.

Bill (hudacek) wrote :

Seems like a no-brainer. Why is this still 'undecided'?

I've put the changes in place and put a hold on xdg-utils in Mint 14 until this eventually is addressed. I hope no security issues come up in the meantime :-/

Steve Leonard (sleonard76) wrote :

For those looking for a quick & dirty solution until this patch is released, put

export GNOME_DESKTOP_SESSION_ID=$MATE_DESKTOP_SESSION_ID

in ~/.bashrc. (Warning: May have undesired side effects)

I can't believe this bug is still around. I am running Mate on Fedora 19 in January 2014 and xdg-email and its' friends still don't
know about Mate.

I added this:

export GNOME_DESKTOP_SESSION_ID=$MATE_DESKTOP_SESSION_ID

and added mate to the detection routine for Gnome and it ***seems*** to work.

My favorite fix is:
http://keramida.wordpress.com/2013/03/18/mate-desktop-support-for-xdg-open/

2014/1/21 Frank_McCormick <email address hidden>

> I added this:
>
> export GNOME_DESKTOP_SESSION_ID=$MATE_DESKTOP_SESSION_ID
>
>
> and added mate to the detection routine for Gnome and it ***seems*** to
> work.
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1001902
>
> Title:
> xdg-open is not mate compatible
>
> Status in The Linux Mint Distribution:
> New
>
> Bug description:
> I had to modify /usr/bin/xdg-open to duplicate the gnome parts and
> replace /gnome/mate/. Some applications like chrome/chromium open
> their file using xdg-open.
>
> Linux Mint 13 RC mate edition
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/linuxmint/+bug/1001902/+subscriptions
>

On 21/01/14 03:55 AM, Leo wrote:
> My favorite fix is:
> http://keramida.wordpress.com/2013/03/18/mate-desktop-support-for-xdg-open/
>
>
> 2014/1/21 Frank_McCormick <email address hidden>
>
>> I added this:
>>
>> export GNOME_DESKTOP_SESSION_ID=$MATE_DESKTOP_SESSION_ID
>>
>>
>> and added mate to the detection routine for Gnome and it ***seems*** to
>> work.
>>
>> --
>> You received this bug notification because you are subscribed to the bug
>> report.
>> https://bugs.launchpad.net/bugs/1001902
>>
>> Title:
>> xdg-open is not mate compatible
>>
>> Status in The Linux Mint Distribution:
>> New
>>
>> Bug description:
>> I had to modify /usr/bin/xdg-open to duplicate the gnome parts and
>> replace /gnome/mate/. Some applications like chrome/chromium open
>> their file using xdg-open.
>>

     That also works. Thanks. I still think it's unbelievable this
bug has hung around this long :)

Leo (leo4ward) wrote :

Using

+open_mate()
+{
+ if gvfs-open --help 2>/dev/null 1>&2; then
+ gvfs-open "$1"
+ else
+ mate-open "$1"
+ fi
+
+ if [ $? -eq 0 ]; then
+ exit_success
+ else
+ exit_failure_operation_failed
+ fi
+}

makes it work better with aplications like dropbox also (launch caja
instead of nautilus for example)

2014/1/21 Frank_McCormick <email address hidden>:
> On 21/01/14 03:55 AM, Leo wrote:
>> My favorite fix is:
>> http://keramida.wordpress.com/2013/03/18/mate-desktop-support-for-xdg-open/
>>
>>
>> 2014/1/21 Frank_McCormick <email address hidden>
>>
>>> I added this:
>>>
>>> export GNOME_DESKTOP_SESSION_ID=$MATE_DESKTOP_SESSION_ID
>>>
>>>
>>> and added mate to the detection routine for Gnome and it ***seems*** to
>>> work.
>>>
>>> --
>>> You received this bug notification because you are subscribed to the bug
>>> report.
>>> https://bugs.launchpad.net/bugs/1001902
>>>
>>> Title:
>>> xdg-open is not mate compatible
>>>
>>> Status in The Linux Mint Distribution:
>>> New
>>>
>>> Bug description:
>>> I had to modify /usr/bin/xdg-open to duplicate the gnome parts and
>>> replace /gnome/mate/. Some applications like chrome/chromium open
>>> their file using xdg-open.
>>>
>
>
> That also works. Thanks. I still think it's unbelievable this
> bug has hung around this long :)
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1001902
>
> Title:
> xdg-open is not mate compatible
>
> Status in The Linux Mint Distribution:
> New
>
> Bug description:
> I had to modify /usr/bin/xdg-open to duplicate the gnome parts and
> replace /gnome/mate/. Some applications like chrome/chromium open
> their file using xdg-open.
>
> Linux Mint 13 RC mate edition
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/linuxmint/+bug/1001902/+subscriptions

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in ubuntu:
status: New → Confirmed
asavah (irherder) wrote :

Also affects all ubuntu versions up to date.
Ubuntu 14.10 is affected too.

The attachment "unofficial patch for xdg-utils scripts." seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in xdg-utils (Ubuntu):
status: New → Confirmed
affects: ubuntu-mate → xdg-utils (Ubuntu)

See upstream : https://bugs.freedesktop.org/show_bug.cgi?id=74125

It may be that xdg-utils v1.1.0-rc2 is patched.

Any chance of Ubuntu updating xdg-utils to v1.1.0-rc2 or simply carrying the patch if not?

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in xdg-utils (Ubuntu):
status: New → Confirmed
affects: xdg-utils (Ubuntu) → ubuntu-mate
affects: ubuntu → xdg-utils (Ubuntu)
Changed in xdg-utils:
status: Unknown → New
Changed in ubuntu-mate:
importance: Undecided → Medium
gravy45 (gravy45) wrote :

This is the patch I put together for Ubuntu MATE 15.04, xdg-open, and it seems to take care of the issue as stated in the title. Am unsure where else xdg-open is used but it has been tested with Virtualbox and Transmission. Would like advice on how to test it more properly to determine if it can be proposed as a solution.

A bug has been raised to update xdg-utils with MATE support here:

  * https://bugs.launchpad.net/ubuntu/+source/xdg-utils/+bug/1457018

A version of xdg-utils that includes MATE support has been published to the following PPAs:

  * https://launchpad.net/~ubuntu-mate-dev/+archive/ubuntu/trusty-mate
  * https://launchpad.net/~ubuntu-mate-dev/+archive/ubuntu/utopic-mate
  * https://launchpad.net/~ubuntu-mate-dev/+archive/ubuntu/vivid-mate
  * https://launchpad.net/~ubuntu-mate-dev/+archive/ubuntu/wily-mate

Anyone running Ubuntu MATE 14.04 will automatically get the updated xdg-utils. Anyone running Ubuntu MATE 14.10 or 15.04 will need to add the appropriate PPA above.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package xdg-utils - 1.1.0~rc1-2ubuntu11

---------------
xdg-utils (1.1.0~rc1-2ubuntu11) wily; urgency=medium

  * Add patch mate-support.diff to add MATE compatibility.
  (LP: #1001902) (LP: #1457018)

 -- Martin Wimpress <email address hidden> Thu, 28 May 2015 09:46:29 +0100

Changed in xdg-utils (Ubuntu):
status: Confirmed → Fix Released
Changed in ubuntu-mate:
status: Confirmed → Fix Released
Changed in xdg-utils:
status: New → Fix Committed
Changed in xdg-utils:
status: Fix Committed → Fix Released
no longer affects: linuxmint
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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