Xdg-open preffered applications

Hello, how can I change the preferred applications that xdg-open uses? For example on pdf files it will open them with firefox, I'd rather have them opened in evince.
I'm using openbox standalone and pcmanfm

Then I don't know what's wrong.  I suppose, however, that it would be possible to work through the various steps that xdg-open takes to open a file and see where it breaks.  For example, if I run "xdg-open Documents/Stuff/Stuff.pdf" then this is what happens:
If the DE is neither gnome, kde nor xfce then xdg-open will set
the variable $DE to "generic" and will also check $BROWSER, setting it to
"firefox:mozilla:epiphany:konqueror:chromium-browser:google-chrome:links2:links:lynx:w3m"
if it isn't set already.
If $DE is "generic" then the function open_generic will be called.
open_generic will check that the file to be opened is a file and if
it is then it will call open_generic_xdg_mime, which will do the following:
$ filetype=`xdg-mime query filetype Documents/Stuff/Stuff.pdf | sed "s/;.*//"`
$ echo $filetype
application/pdf
$ default='xdg-mime query default "$filetype"`
$ echo $default
evince.desktop
$ xdg_user_dir="$XDG_DATA_HOME"
$ xdg_system_dirs="$XDG_DATA_DIRS"
$ x=`echo "$xdg_user_dir:$xdg_system_dirs" | sed 's/:/ /g'`
We need to select the correct path manually at this point, so
$ echo $x
/home/david/.local/share /usr/share /usr/local/share
evince.desktop is in /usr/share/applications, so
$ x="/usr/share/"
$ file="$x/applications/$default"
$ command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | first_word`"
bash: first_word: command not found
Oops, first_word is a function
$ command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2-`"
$ echo $command
evince %U
$ command="evince"
$ command_exec=`which $command 2>/dev/null`
$ echo $command_exec
/usr/bin/evince
$ $command_exec Documents/Stuff/Stuff.pdf
** (evince:26937): WARNING **: Failed to create dbus proxy for org.gnome.SettingsDaemon: Could not get owner of name 'org.gnome.SettingsDaemon': no such name
Evince has started at this point and opened Documents/Stuff/Stuff.pdf!

Similar Messages

  • Whippet (formerly Ease): application launcher and xdg-open replacement

    Whippet is a Bash script which opens files and urls with applications associated by name and/or MIME-type. Applications and associations may be customized within an SQLite database, and can be weighted according to the importance you assign to them. Whippet can serve as an xdg-open replacement for those who wish to have total control over which applications are associated with which types of files. For more experienced users only, but ideal for integrating with light desktop environments and file managers. Whippet uses dmenu to manage its menus, and you will also need a program such as DB Browser for SQLite for managing the SQLite database. Once installed from the AUR package, execute the command 'man whippet' for more information.
    Edit on 2015-06-23: Updated for Whippet 2.1.2.
    Edit on 2015-03-15: Rebranded as Whippet; was formerly Ease.
    Last edited by ninian (Today 14:24:22)

    Version 1.2.0 has been released, with the following new features:
    Can now optionally associate applications by matching regexes to file/URI names in the configuration file.
    New option -n and configuration variable $assocname control the usage of associations by file/URI name.
    Also:
    Fixed a bug causing a loop in the fallback menu when an alternative configuration directory is specified.

  • Can't open links through applications - xdg-open default browser?

    Trying to open a link through an application such as Pidgin gives me the following error:
    /usr/bin/xdg-open: line 478: firefox: command not found
    /usr/bin/xdg-open: line 478: mozilla: command not found
    /usr/bin/xdg-open: line 478: epiphany: command not found
    /usr/bin/xdg-open: line 478: konqueror: command not found
    /usr/bin/xdg-open: line 478: chromium-browser: command not found
    /usr/bin/xdg-open: line 478: google-chrome: command not found
    /usr/bin/xdg-open: line 478: links2: command not found
    /usr/bin/xdg-open: line 478: links: command not found
    ...and then shows me the following in the terminal: http://gyazo.com/aa5232a846762f42edc95994f8a2a15c
    It doesn't even try to open it with Aurora which is what I have set as my default browser in Xfce settings.
    xdg-open http://www.google.com produces the same effect.
    This only happens since I did a fresh Arch install a few days ago.

    There are so many wonderful tools in the *nix community, xdg-open is really not one of them (IMO).  It is drastically overly complex - it's just a really convoluted shell script, open it up in an editor sometime.  This complexity leads to countless situations in which it will produce undesireable behavior.  I may be the least "unix-like" tool on my computer ... or at least it was until I removed it and replaced it with a much simpler version.
    Admittedly this is the jumping-ship option.  Or really jumping-ship while tossing a molatov cocktail back to watch the whole ship burn ... but it works.  The skeleton of my replacement script can be found here.  Customize it to your tastes once, then plop it in xdg-open's place and your set.  Just keep a copy around to re-replace xdg-open if/when it gets updated by pacman.

  • Xdg-open is indecisive and causes applications to not respond!

    For some reason, xdg-open will not respond usually when only called once on a file. Repeating the command rapidly however will work eventually (!?)
    $ touch foo.txt
    $ xdg-open foo.txt
    $ xdg-open foo.txt
    $ xdg-open foo.txt # after rapid [up-key]+[enter]s, this will work, for example
    $ xdg-mime query filetype foo.txt
    text/plain
    $ xdg-mime query default text/plain
    org.gnome.gedit.desktop
    It looks like everything should work fine, from the examples given above, but the problem is there. As a result, I have to repeat the command rapidly in the command line to work, and in Chromium I have to keep on clicking "open in folder" to get Nautilus to launch
    I remember when the problem started - it was when I installed libreoffice, and for whatever not-so-smart reason, it sets itself as the default app for text/plain, and application/javascript, in my limited usage. So I used:
    $ xdg-mime default gedit.desktop text/plain
    $ xdg-mime default gedit.desktop application/javascript
    ... to try and solve the issue, however I faced the same symptoms I am facing now, and even after removing .local/applications/*, I'm still experiencing the same problems
    I'm in desperate need of some help, and would appreciate anyone who has insight on this

    I've had this bug ever since GNOME 3.14 came in to Arch but have never found anybody else reporting it so I thought it was something specific to my configuration. Glad to see some others have it!
    If you run xdg-open once then it does start nautilus but nautilus does not open the window, e.g. "xdg-open .". Nautilus will stay running for about 1 min and it you run xdg-open again within that time it will work and open the window. As soon as Nautilus stops (or after you stop it with nautlius -q), then the next invocation of xdg-open will not work.
    PS later edit: I should point out that, consistent with my description of the problem above, if you use Nautilus to manage your desktop (i.e. set "Icons on Desktop" in GNOME Tweak Tool) then you won't see this bug because Nautilus is always running.
    Last edited by bulletmark (2014-12-22 05:34:16)

  • Xdg-open didn't read ~/.local/share/applications/default.list

    xdg-open doesn't read ~/.local/share/applications/default.list, and the only way to associate application and filetype is do following command:
    xdg-mime default thur.desktop inode/directory
    But, the content of default.list will be rewrite.
    xdg-open ignore everything I have added to default.list manually.
    It looks like xdg-open have something like database to track association I added through  command, then dump it to default.list after I execute the command.
    Does anyone have idea what wrong happened? tell me please
    Last edited by lanyitin800830 (2012-05-10 18:16:10)

    Update: This works (line 402 in /usr/bin/xdg-open):
    ---( From )---
    $command_exec "$1"
    ---( To )---
    eval `"$command_exec" "$1"`
    At least for me, I get the expected behavior for pdfs (evince opens the file, nothing else) with this change. Is this a bug?

  • [SOLVED] xdg-open: no method available for opening

    I'm using Openbox. Whenever I try to use xdg-open to open a file or link from the command line, I get the error "xdg-open: no method available for opening". This happens with all files and links, regardless of type. I've tried editing ~/.local/share/applications/mimeapps.list, both manually and with xdg-mime; neither had any effect. I've also tried setting environment variables such as $BROWSER; that had no effect, either.
    Strangely, exo-open works with no problem (although the only way I've found to change file associations is by using Thunar). I would just switch to exo-open, except I've encountered a couple of programs that rely on xdg-open for opening web links and the like.
    Has anyone else seen this problem? At this point, I'm pretty confused, and I would appreciate any help. Thanks!
    Last edited by morganmay (2013-11-19 16:31:08)

    Was poking around with this again. I still haven't solved the problem, but I did notice an error that might be a clue. When I enter "xdg-settings get default-url-scheme-handler", I get the error "xdg-settings: unknown desktop environment". I don't have a DE installed, just openbox (although as far as I can tell, XDG doesn't require a DE).
    Does anyone know what this means? Searches for this error have only led me to threads recommending solutions that I've already tried without success (editing mimeapps.list, setting environment variables like BROWSER, etc.).

  • Xdg-open for irc links in chromium

    Hey!
    I know that the first thing to do is search before bothering other people and I did it a lot. Google, posts, how-to`s, wikis... I see my last chance in asking this community
    So here is my problem:
    I use chromium as default browser and konversation for irc on lxde desktop. chromium uses xdg-open to associate files and links with programs. I tried everything I found but couldn`t get it to work. When I click on an IRC link, it asks me for opening the associated program, I confirm with yes and nothing happens. When trying to open an irc link from the terminal I get
    xdg-open: no method available for opening 'irc://...'
    I got it to work with mimeo, so please no suggestions in this direction, I would like to learn how to do it without it and so to learn it distribution independently.
    For anyone looking for it, this is the working mimeo solution
    $ yaourt -Sy mimeo xdg-utils-mimeo mime-type
    $ nano /home/tom/.config/mimeo.conf
    /usr/bin/konversation
      ^irc://
    # there have to be exactly two spaces in front of ^irc://
    This is the working solution in gnome using gconf:
    $ gconftool-2 --set --type=string /desktop/gnome/url-handlers/irc/command 'konversation "%s"
    $ gconftool-2 --set --type=bool /desktop/gnome/url-handlers/irc/enabled true
    $ gconftool-2 --set --type=bool /desktop/gnome/url-handlers/irc/need-terminal false
    This is what I tried in lxde:
    $ yaourt -Sy mime-type xdg-utils
    $ xdg-mime default konversation.desktop application/irc
    $ xdg-mime default konversation.desktop x-scheme-handler/irc
    $ xdg-mime default konversation.desktop application/x-xdg-protocol-irc
    $ nano /usr/share/applications/kde4/konversation.desktop
    MimeType=application/irc;x-scheme-handler/irc;x-xdg-protocol-irc
    $ nano /usr/share/mime/packages/irc.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
    <mime-type type="application/irc">
    <comment>irc url</comment>
    <magic priority="50">
    <match value="%irc://-" type="string" offset="0"/>
    </magic>
    <alias type="application/irc"/>
    </mime-type>
    </mime-info>
    $ update-mime-database /usr/share/mime/
    I appreciate every suggestion. I`ll be on the road for two days and will try your suggestions on the weekend and will give feedback.
    Please explain as understandable as possible, at best with all commands and paths to the files - this is the newbie corner, right?
    Thanks in advance
    Tom
    Last edited by archtom (2011-06-15 19:44:57)

    really noone? Would be so glad if anyone could help!
    Last edited by archtom (2011-06-20 20:21:06)

  • Xdg-open is slow opening files

    Whenever I use xdg-open to open an application it takes a while until the application is shown, but if I try to open it with the application itself it works almost instantaneously. While using xdg-open I can notice a high increase of the cpu usage.
    What could it be that's causing this issue? Is there maybe a log file I can check to see what's going on under the hood? This issue is happening with gpicview (for images), nemo, and thunar; I haven't tried with other applications but I assume it's going to be the same.
    As relevant info I might add that I'm using openbox and no desktop environment. I'll upload any config files if requested, but I don't really know what to include as a start besides my mimeapps.list:
    #~/.local/share/applications/mimeapps.list
    [Default Applications]
    inode/directory=Thunar.desktop
    image/png=gpicview.desktop
    [Added Associations]
    image/png=gpicview.desktop;
    I've checked the wiki for xdg-open and all the forums (arch and outside of arch) and have just found people with the same issue, but no answers whatsoever.
    Any help on this would be much appreciated.

    After analyzing the loop (and the inner search_desktop_file function), I can tell that function is what's taking all the CPU time, also I can tell that only 3 iterations of the loop are run, one for each X, which have the values:
    $x_1 = Thunar.desktop /home/josep/.local/share/
    $x_2 = Thunar.desktop /usr/local/share/
    $x_3 = /usr/share/
    I can tell the first two searches take close to no time, and actually, the binary /usr/bin/thunar, which is located in the third iteration, doesn't take much time either, so surprisingly what's eating most of CPU resources is this part of the script:
    command="$(get_key "${file}" "Exec" | first_word)"
    command_exec=`which $command 2>/dev/null`
    arguments="$(get_key "${file}" "Exec" | last_word)"
    arg_one="`echo "$arg" | sed 's/[&*\\]/\\\\&/g'`"
    icon="$(get_key "${file}" "Icon")"
    if [ "${icon}" != "" ]
    then
    icon="--icon '${icon}'"
    else
    icon="''"
    fi
    # FIXME: Actually LC_MESSAGES should be used as described in
    # http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s04.html
    localised_name="'$(get_key "${file}" "Name")'"
    arguments_exec="$(echo "$arguments" | sed -e 's*%[fFuU]*"'"$arg_one"'"*g' \
    -e 's*%i*'"$icon"'*g' \
    -e 's*%c*'"$localised_name"'*g')"
    The first two variables command and command_exec are set to "thunar" and "/usr/bin/thunar", and this happens relatively fast (although it takes some time to find it, it's not even a 10% of the total time).
    EDIT: I think all signs lead to the disk read taking too long (for example the get_key function which reads the .desktop file looking for the asked key, takes too much), but this is weird, as I had never encountered this issue in other linux distributions, everything has ran always smooth and fine, despite not having a good machine.
    EDIT2: After finally tracking down the issue, I've found this loop: (inside the get_key function)
    while read line
    do
    echo "readline" 1>&2
    case "$line" in
    "[Desktop Entry]")
    desktop_entry="y"
    # Reset match flag for other groups
    desktop_entry=""
    # Only match Desktop Entry group
    if [ -n "${desktop_entry}" ]
    then
    echo "${line}" | grep -E "^${key}=" | cut -d= -f 2-
    fi
    esac
    done < "${file}"
    More than 90% of CPU time is spent in this function, but I can't see why. Parsing a .desktop file is not a difficult task by any means and even if this was reading the file every time, everything would be cached in the ram anyway, as modern OSs use paging for that matter (and by modern I mean not modern at all) and I'm well aware that linux does).
    So TL;DR I don't understand how can the simple task of parsing a .desktop file take more time than opening google chrome or gimp. Any help on that?
    Last edited by setzer22 (2014-07-27 19:07:43)

  • Xdg-open strange behaviour

    When I have no defaults.list and mimeapps.list, xdg-open opens text/plain with gvim. But when I create defaults.list in /usr/share/applications/ and add the following lines :
    [Default Applications]
    text/plain=emacs.desktop
    it opens text files with firefox.
    However, if I move /usr/share/applications/defaults.list to ~/.local/share/applications/mimeapps.list, it opens text files with emacs as expected.
    What is happening with xdg-open?

    Thanks for this quick reply. Yes, the $ is present in the real path and yes, mapping seems to work. If it is this easy, why doesn't the default file>open work, this looks like a bug? It is not that userfriendly if every user (hundreds) should map there own drive letter to get this to work.

  • [SOLVED] Chromium not calling xdg-open

    Hi,
    I have been trying to get Chromium to call external applications based on their name and/or mime type. My desktop is XFCE.
    I have read about setting up the xdg-utils, and believe I have it configured. The following command line when run from bash opens up acroread and displays the PDF:
    xdg-open http://cran.r-project.org/doc/manuals/R-intro.pdf
    My ~/.local/share/applications/defaults.list file is:
    application/pdf=acroread.desktop;
    But when I click on the link in chromium I get the "Save File" dialog.
    As a test, I edited the /usr/bin/xdg-open shell script, and made it write to a file in /tmp when ever it is called. (The second line where I send the date to the /tmp/xdg-open.log file.)
    #!/bin/sh
    /usr/bin/date >> /tmp/xdg-open.log
    # xdg-open
    # Utility script to open a URL in the registered default application.
    # Refer to the usage() function below for usage.
    # Copyright 2009-2010, Fathi Boudra <[email protected]>
    When I try and download a PDF in chromium, it never adds to the /tmp/xdm-open.log file. (But does if I call it from the command line as I did above.)
    So to me, it looks like chromium isn't even calling the xdg-open script.
    Any one have any ideas?
    Thanks in advance.
    Last edited by landzend (2012-11-16 10:54:29)

    hiciu wrote:
    Hello,
    For me, chromium is not using xdg-open. You can verify it with:
    strace -e process chromium
    Then download something and try to open it from chromium. As for solution, try this: install perl-file-mimeinfo package and setup it with 'mimeopen --ask-default some-pdf-file.pdf'.
    landzend wrote:
    I have read about setting up the xdg-utils, and believe I have it configured. The following command line when run from bash opens up acroread and displays the PDF:
    xdg-open http://cran.r-project.org/doc/manuals/R-intro.pdf
    This is separate issue, it should run browser (http:// protocol), not acroread. Check this link: http://hiciu.org/some-pdf-file.pdf (harmless). All you know before you open it is the url, not the file type.
    Thanks. I already had the "perl-file-mimeinfo" installed.
    Yes. The link you gave above is type "image/jpeg", so the browser has to start the download to even know what it has coming.

  • [solved] Xdg-open to open everything with file manager

    I like to screw around with my system constantly and xdg-utils is an annoying utility to have to constantly fiddle with. I know there is a way to get xdg-open to open everything with the default file manager, but my google fu has failed me. As of right now I use pcmanfm, and I'm fairly certain I'm sticking with it for the long haul.
    Last edited by shamanstk (2010-05-11 17:57:15)

    Mr.Elendig wrote:perl-file-mimeinfo installed?
    This helped with a xdg-open anomaly. Before installing perl-file-* packages, pcmanfm used to open everything in firefox (which is set as default browser in xdg-open). Thought could be helpful to anyone having problems with applications using xdg-open.
    Last edited by shemz (2010-08-03 15:02:52)

  • Linopen - Yet another xdg-open replacement

    Inspired by Taylorchu's mimi, I decided to make xdg-open replacement written in bash that has somewhat flexible configuration.
    You can match either, extensions, mime types, mime groups, or regular expressions of the filename.
    You can also specify applications that you wish to open in terminal, and linopen knows when the process should be opened in new terminal or in your current open terminal.
    Example configuration
    # linopen configuration
    # enviroiment variables can be used
    # Specify your terminal emulator here
    # for terminal support.
    terminal=xterm
    # Specify all programs you want to
    # open in terminal like this:
    interm=vim
    # There are 4 ways to match filetypes.
    # The following examples are in the order
    # which linopen chooses the program as well.
    # 1. File extension
    # .png:sxiv
    # .mp4:mplayer
    # .txt:vim
    # 2. Mime type
    # image/png:sxiv
    # video/mp4:mplayer
    # text/plain:vim
    # 3. Mime category
    image:sxiv
    video:mplayer
    audio:mplayer->interm # you can also specify the interm rule explictly after '->'
    text:vim
    # 4. Regexp
    # Match some protocols by default
    ?'^http:\/\/':$BROWSER
    ?'^https:\/\/':$BROWSER
    ?'^www.':$BROWSER
    # Directory rule for directories
    # ideally you want to use file manager
    # here if you are a GUI user.
    directory:echo
    # Default rule just echoes back whatever
    # was feed. If you are using DE you could
    # just map a file manager here and it would
    # integrate with your system.
    default:echo
    PKGBUILD here
    Refer to the configuration file for more detailed how-to.
    There is also 'open' symlink to xdg-open to emulate Mac Os X behaviour.
    Last edited by Cloudef (2012-07-17 16:08:41)

    In this case it would be better to change the PKGBUILD to this
    # Maintainer: Cloudef <[email protected]>
    # Intelligent and suckless replacement for xdg-open
    pkgname=linopen
    pkgver=1.0
    pkgrel=1
    pkgdesc='Intelligent and suckless replacement for xdg-open'
    arch=('any')
    url='http://cloudef.eu'
    license=('WTFPL')
    provides=('xdg-utils')
    conflicts=('xdg-utils')
    backup=('etc/linopen.conf')
    source=('xdg-open' 'linopen.conf')
    package() {
    cd "$srcdir"
    mkdir -p "${pkgdir}/usr/bin"
    mkdir -p "${pkgdir}/etc"
    ln -s "/usr/bin/xdg-open" "$pkgdir/usr/bin/open"
    install -m755 xdg-open "${pkgdir}/usr/bin/"
    install -m755 linopen.conf "${pkgdir}/etc/"
    md5sums=('f5487fc4c305a20124da7bb164e6b04d'
    '2c9078f3ee82d619dc150bb44837d9e8')
    or (imho nicer) with this package function
    package() {
    install -Dm755 "$srcdir/xdg-open" "${pkgdir}/usr/bin/xdg-open"
    install -Dm755 "$srcdir/linopen.conf" "${pkgdir}/etc/linopen.conf"
    ln -s "/usr/bin/xdg-open" "$pkgdir/usr/bin/open"
    Last edited by Army (2012-07-03 16:04:13)

  • Fixing xdg-open

    Hi all fellow archers!
    For quite some time, those of us running without a desktop environment have been struggling to cope with xdg-open for handling file opens (especially for Chromium).
    Although xdg-open has gotten a bit better over time (it now falls back to mimeopen if it doesn't know what to do).
    Unfortunately, this solution is not a "proper" one since mimeopen currently does not work with URIs, only with files.
    To get around this, I have made two minor adjustments to my system to make it handle even URIs gracefully.
    The first is a hack, the second a (small) patch to xdg-open:
    The hack:
    ln -s /usr/share/applications/mimeinfo.cache to /usr/share/applications/defaults.list
    this will make all applications that register MIME types using MimeType= in their .desktop files the default for their respective MIMEs.
    This is required since xdg-mime does not check mimeinfo.cache when looking up applications for mime types, only defaults.list files.
    If multiple applications happen to register for the same MIME type, I'm not sure which is chosen as the default, but this should be overridden in ~/.local/share/applications/defaults.list anyway.
    The second part, the patch, can be viewed here: http://pastebin.com/EduF8GjC
    For those not used to merging patches like this, download the raw .patch file from here: http://pastebin.com/download.php?i=EduF8GjC , and then run
    sudo patch /usr/bin/xdg-open <xdg-open_uri_patch.txt
    Note that you shouldn't normally just do what strangers like me tell you to, so have a look through the .patch file before patching /usr/bin/xdg-open to make sure I haven't done something naughty.
    There are also unreleased patches for this upstream here and here if you'd prefer using those, but they may not patch nicely against the current Arch version.
    Essentially, whenever a URI is being opened with the internal, generic opener, xdg-mime is queried for the default application for "x-scheme-handler/$scheme" where $scheme is the scheme part of the URI.
    That application is then started with the full URI the path to open.
    Now sit back and enjoy Chromium opening all your files correctly, even magnet:, mailto: and spotify: links (if you've got a client for each installed of course).
    Jon
    PS: The patch has also been submitted to the Portland/XdgUtils team as bug #44873
    EDIT: Turns out this has already been patched after a similar bugreport, just not released, in these commits. The patch is still needed until a release with these changes comes though. Feel free to use the upstream patches instead if you want.
    Last edited by Jonhoo (2012-01-17 22:49:21)

    I tried to find out what was going on using strace. Here is the output:
    strace -f /usr/bin/gvfs-open file.pdf 2>&1 | grep exec
    execve("/usr/lib/xfce4/exo-1/exo-helper-1",
    Why is gvfs-open resorting to xfce's opener while I am running gnome???
    A bit earlier in the trace, gvfs loads /usr/lib/gio/modules/libexo-module-1.so which is certainly the culprit.
    My question is then: how do I make gvfs-open use gnome's facilites?
    --- edit ---
    Looks like my problem:
    https://qa.mandriva.com/show_bug.cgi?id=62203
    --- edit 2 ---
    Some more info:
    http://penguincopter.blogspot.com/2010/ … ty-of.html
    Last edited by benob (2011-02-21 18:38:56)

  • Xdg-open Fix

    This is for any frustrated by Google Chrome using random applications to open its downloads.
    Google Chrome uses xdg-open to open its downloads. Since I don't use Gnome or KDE, the DE environment variable is unset. If the DE environment variable is unset or set to "generic", xdg-open uses the open_generic_xdg_mime() function to choose the application to open files. This function incorrectly determines the location of the .desktop file. It will come up with something like
    /usr/share/applications//usr/share/applications/mplayer.desktop
    instead of
    /usr/share/applications/mplayer.desktop.
    To fix this I added
    default=`echo $default | sed "s|[^\w]*/||"`
    below the line (line number 384)
    default=`xdg-mime query default "$filetype"`.
    Setting the default application with xdg-mime default [.desktop file] [mime-type] populates the $HOME/.local/share/applications/defaults.list file. With the fix, xdg-open now correctly uses this file and open applications as expected.

    By the way OP. If you are using pcmanfm: here is handy replacement for /usr/bin/xdg-open  - http://dumpz.org/15027/
    It handles http(s), mail and magnet links, and on all other lets pcmanfm deside

  • Xdg-mime reports application/xml for fodt

    Hi all
    1) I have update the system wide mime database.
    2) Then I have followed instructions here https://wiki.archlinux.org/index.php/Ch … n_via_MIME:
    > cat ~/.local/share/mime/packages/fodt.xml
    =>
    <?xml version="1.0"?>
    <mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
      <mime-type type="application/vnd.oasis.opendocument.text">
        <glob pattern="*.fodt"/>
      </mime-type>
    </mime-info>
    >update-mime-database ~/.local/share/mime
    3) Also, just in case:
    >  xdg-mime install --novendor fodt.xml
    But everything to no avail:
    > xdg-mime query filetype eea.fodt
    => application/xml
    instead of application/vnd.oasis.opendocument.text. So xdg-open opens *.fodt with vim (my default app for xml files) instead of libreoffice-writer.
    Any clue???
    Regards
    Carlos

    I too got annoyed at those unreliable mime-type inspectors and went searching for a better one that used the command line. I found "perl-file-mimeinfo" which comes with a wonderful script called "mimetype".

Maybe you are looking for

  • Material Transaction Open Interface Error

    Hi, I'm getting following Error in Cost Manager after running the Transaction Open Interface, Interface work well to update the stocks, but it returns error Layer Cost Worker Concurrent. Error1 Bills of Material: Version : 12.0.0 Copyright (c) 1979,

  • 7344 Motion board stop command causing system to drop

    I have a hydrolic system(in closed loop mode) controlled by a 7344s analog output. a value changes depending on the voltage from the 7344: positive voltage lets water into the system negative voltage lets water out of the system. due to the design of

  • [Forum FAQ] How to use multiple field terminators in BULK INSERT or BCP command line

    Introduction Some people want to know if we can have multiple field terminators in BULK INSERT or BCP commands, and how to implement multiple field terminators in BULK INSERT or BCP commands. Solution For character data fields, optional terminating c

  • IPOD VIDEO 30GB not recognized by iTunes or My PC

    So I have this ipod that I'm trying to revive. I'm not even sure which generation it is, but it's a 30GB ipod classic and I bought like in 2005. Here's the thing, this ipod has been in my drawer for years and when I turn it on it says "Use itunes to

  • Dynamic text and embedded font

    Hi, I'm new to Flash and AS3, and I'm having a problem when I do the following: I create an empty dynamic text field in the authoring environment, click "Embed...", and choose the character sets that I want (I get the same results when I embed the en