Adapting /usr/bin/xdg-open to recognize Mate too

Antonielly Garcia Rodrigues antonielly at gmail.com
Fri Mar 1 12:12:35 PST 2013


Dear xdg-utils developers,

In the interest of maximizing the usefulness of "xdg-open" for any popular
desktop environment that exists for Linux, would it be politically feasible
to adapt the official code for the next version of "/usr/bin/xdg-open" so
that it can work properly for the Mate Desktop Environment?

After performing a review of the (very readable) source code of "xdg-open"
in Linux Mint 13 Mate, I believe that only 3 functions would be affected:

1) main/implicit (final code): addition, after "gnome)":
case "$DE" in
...
    mate)
    open_mate "$url"
...

2) detectDE: addition, after the 3rd line of that function:
detectDE()
{
    ...
    elif [ x"$MATE_DESKTOP_SESSION_ID" != x"" ]; then DE=mate;
    elif `dbus-send --print-reply --dest=org.freedesktop.DBus
/org/freedesktop/DBus org.freedesktop.DBus.GetNameOwner
string:org.mate.SessionManager > /dev/null 2>&1` ; then DE=mate;
...
}

As you can see, the code is similar to the Gnome detection. The rationale
for the small differences is the following set of tests on Linux Mint 13
Mate:
$ printenv GNOME_DESKTOP_SESSION_ID
$ printenv MATE_DESKTOP_SESSION_ID
this-is-deprecated
$ dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus
org.freedesktop.DBus.GetNameOwner string:org.gnome.SessionManager
Error org.freedesktop.DBus.Error.NameHasNoOwner: Could not get owner of
name 'org.gnome.SessionManager': no such name
$ dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus
org.freedesktop.DBus.GetNameOwner string:org.mate.SessionManager
method return sender=org.freedesktop.DBus -> dest=:1.238 reply_serial=2
   string ":1.0"

3) open_mate: creation [with code very similar to open_gnome()]
open_mate()
{
    if gvfs-open --help 2>/dev/null 1>&2; then
        gvfs-open "$1" #strangely, this wasn't forked (at least yet). All
the other gvfs-* programs were forked.
    else
        mate-open "$1" #a fork of gnome-open
    fi

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

Rationale:
"mate-open" is a fork of "gnome-open".
Many "gvfs-*" program were forked, but strangely, Mate hasn't forked
"gvfs-open" (at least yet):
$ gvfs-
gvfs-cat            gvfs-mkdir          gvfs-rename
gvfs-copy           gvfs-monitor-dir    gvfs-rm
gvfs-info           gvfs-monitor-file   gvfs-save
gvfs-less           gvfs-mount          gvfs-set-attribute
gvfs-ls             gvfs-move           gvfs-trash
gvfs-mime           gvfs-open           gvfs-tree
$ matevfs-
matevfs-cat      matevfs-info     matevfs-monitor
matevfs-copy     matevfs-ls       matevfs-mv
matevfs-df       matevfs-mkdir    matevfs-rm

Regards,

Antonielly Garcia Rodrigues
Software engineer @ Brazil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/xdg/attachments/20130301/a0a2af30/attachment.html>


More information about the xdg mailing list