Linux – Why Does XDG-Open Fail Although XDG-Mime Query Default Succeeds on Ubuntu 10.10?

linuxUbuntu

On Ubuntu 10.10, xdg-open fails to open the file and give me the error:

No application is registered as handling this file

But xdg-mime query defaut ... succeeds for the mime type. Why?

Here is my process:

  1. Added a new mime type application/vnd.xx by xdg-mime install mytype.xml. Then xdg-mime query filetype <file name> shows that the new mime type is recognized.

  2. I wrote my desktop entry file "my-app.desktop" like this:

    [Desktop Entry]
    Name=xxx
    Comment=xxx
    Icon=
    Exec=/usr/bin/my-app %U
    Terminal=false
    Type=Application
    Categories=Utility;
    MimeType=application/vnd.xx;
    
  3. I copied this desktop file to ~/Desktop. After I re-login, I saw the shortcut on the desktop and xdg-mime query defualt application/vnd.xx printed out this desktop file.

  4. But, xdg-open <file name> fails with the error:

    No application is registered as handling this file

I've installed nautilus. Do I miss something? How do I fix this?

Best Answer

I don't know off the top of my head if this is the cause of your problem, but in general application *.desktop files need to be in specific places to be fully recognized. Try moving your my-app.desktop to ~/.local/share/applications/my-app.desktop (create that directory first if needed: mkdir -p ~/.local/share/applications). If you used a full pathname to the *.desktop file, change it to just the basename; I don't think pathnames work as expected there.

Related Question