Xfce Forum

Sub domains
 

You are not logged in.

#1 2015-07-07 03:24:37

lnx64
Member
Registered: 2014-10-07
Posts: 39

xdg-open nightmare

I'm having hell with xdg-open.  It seems Xfce stores mimeapps.list in ~/.config/ but xdg-open wants it in ~/.local/share/applications/

So what I did, was create a symbolic link to the real location where Xfce stores it.

This worked ok, but then when I went to do: "xdg-mime default transmission-gtk.desktop x-scheme-handler/magnet" to add a line for Google Chrome to know how to open magnet links, it broke the symbolic link and then basically made the link become it's own file.

I'm at a loss at how I can properly handle these two locations for basically the same file.  I'm not sure why Xfce didn't just store mimeapps.list in the proper location to begin with.

Xubuntu 15.04.

Offline

#2 2015-07-07 13:28:58

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,485

Re: xdg-open nightmare

Google Chrome to know how to open magnet links

There is this bug report.

I don't use chrome but I installed it in Xubuntu 15.04 and noticed the same problem as you are having. I then installed chrome in my Arch installation, and it worked fine.

.

So I did some digging, and found that the xdg-open file in Arch differs from the one in Xubuntu. There are many differences, but specifically, in the "detectDE" function. The function in Arch looks like this:

detectDE()
{
    # see https://bugs.freedesktop.org/show_bug.cgi?id=34164
    unset GREP_OPTIONS

    if [ -n "${XDG_CURRENT_DESKTOP}" ]; then
      case "${XDG_CURRENT_DESKTOP}" in
         ENLIGHTENMENT)
           DE=enlightenment;
           ;;
         GNOME)
           DE=gnome;
           ;;
         KDE)
           DE=kde;
           ;;
         LXDE)
           DE=lxde;
           ;;
         MATE)
           DE=mate;
           ;;
         XFCE)
           DE=xfce
           ;;
      esac
    fi

    if [ x"$DE" = x"" ]; then
      # classic fallbacks
      if [ x"$KDE_FULL_SESSION" != x"" ]; then DE=kde;
      elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome;
      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.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 xprop -root 2> /dev/null | grep -i '^xfce_desktop_window' >/dev/null 2>&1; then DE=xfce
      elif echo $DESKTOP | grep -q '^Enlightenment'; then DE=enlightenment;
      fi
    fi

    if [ x"$DE" = x"" ]; then
      # fallback to checking $DESKTOP_SESSION
      case "$DESKTOP_SESSION" in
         gnome)
           DE=gnome;
           ;;
         LXDE|Lubuntu)
           DE=lxde; 
           ;;
         MATE)
           DE=mate;
           ;;
         xfce|xfce4|'Xfce Session')
           DE=xfce;
           ;;
      esac
    fi

    if [ x"$DE" = x"" ]; then
      # fallback to uname output for other platforms
      case "$(uname 2>/dev/null)" in 
        Darwin)
          DE=darwin;
          ;;
      esac
    fi

    if [ x"$DE" = x"gnome" ]; then
      # gnome-default-applications-properties is only available in GNOME 2.x
      # but not in GNOME 3.x
      which gnome-default-applications-properties > /dev/null 2>&1  || DE="gnome3"
    fi
}

The detectDE() function in the Xubuntu version of the xdg-open file uses the following command to identify an xfce environment:

xprop -root _DT_SAVE_MODE

...which of course does not work. In contrast, the Arch version identifies it via the "XDG_CURRENT_DESKTOP" environment variable.

.

It would appear, that because Xfce is not properly being identified, xdg-open borks.

.

Interestingly, the Arch package source is a specific commit:

source=(git://anongit.freedesktop.org/xdg/xdg-utils#commit=686f6f48f6ff939c757881e3fc7a852b61d32c94)

.

One way to work around it is to manually edit the /usr/bin/xdg-open file and change the section that reads:

detectDE

if [ x"$DE" = x"" ]; then
    DE=generic
fi

...to read:

detectDE

if [ x"$DE" = x"" ]; then
    DE=xfce
fi

...so that it forces an xfce environment. However, you'll need to make this change every time xdg-utils updated.

.

This is most likely an xdg-utils or Xubuntu bug. You should probably follow up there.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#3 2015-07-07 15:28:12

lnx64
Member
Registered: 2014-10-07
Posts: 39

Re: xdg-open nightmare

Thanks for that, it got the magnet links ultimately working finally.  There's still the situation of the two locations for mimeapps.list, in which I need a symbolic link to keep xdg-open updated for what I openening with what, but using xdg-mime to manually add an entry in the symbolic link, which should just update the original file, does not actually happen.  Instead the symbolic link breaks, and then it becomes it's own file which is very strange.

Offline

#4 2015-07-07 15:43:26

lnx64
Member
Registered: 2014-10-07
Posts: 39

Re: xdg-open nightmare

As for the bug you posted, turns out Ubuntu knows.  They have for almost 5 years now, and still no fix.

https://bugs.launchpad.net/ubuntu/+sour … ug/1388922

Kinda sad, I may be switching distros soon if they don't fix these simple silly bugs.

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.013 seconds, 8 queries executed - Memory usage: 536.6 KiB (Peak: 537.45 KiB) ]