• xdg-open doesn't work for opening directories

    I used to use Linux Mint and there, I would type, for instance, xdg-open . and it would open my current directory in a window. However, when I try to open any directory using xdg-open in Antergos, nothing happens. Why?

  • @koori.13
    Hi friend!
    I admit i never used this command before, although i just tested it here and is working fine
    something like xdg-open / or xdg-open /home open the folder.

    You didn’t specify your actual desktop nor your file manager but you could simple use you FM like:

    nemo /home
    caja /home
    thunar /home
    nautilus /home

    etc etc

  • It seems that you don’t have a default application associated with the inode/directory mimetype. Which is unusual, since I think Antergos has it set for you, based on the DE you chose during installation. To be sure issue the following command:

    $ xdg-mime query default inode/directory

    If you get no output, there’s no association and you need to create one. If you get an output, then that is the .desktop file that is being associated with directories.

    • Assuming you got output, if you then type the following command, you should learn what program is being used to open directories, and possibly why it is failing:
      $ grep '^Exec=' ~/.local/share/applications/<name.desktop>
      Replace <name.desktop> with the file named by the previous command.

    • Otherwise, you need to create the association. This depends on the Desktop Environment and what file manager you wish to use by default. Many Desktop Environments have an option to name global default applications, like a default browser, default mail program and default file manager. Look for it in the desktop environment settings.

      If otherwise you wish to do this manually, I will need to create the default application association by using a command such as $ xdg-mime default <name.desktop> inode/directory. For this to work a .desktop file for the application you wish to use must already exist in ~/.local/share/applications/. If you don’t have such a file, it needs to be created. In that case, open any other .desktop file in that directory in your editor to have an idea of their format. And get also help from the XDG Specification.

  • Thank you both. The default app is org.gnome.Nautilus.desktop (that’s the output I got from the xdg-mime query). Gnome is the DE, sorry I forgot to mention that. The ~/.local/share/applications/ directory seems to be empty. Not sure how to proceed.

  • Is that file present in /usr/share/applications?
    And if so, what is the output of $ grep '^Exec=' /usr/share/applications/org.gnome.Nautilus.desktop

  • Yes, it is. The output is:
    Exec=nautilus --new-window %U
    Exec=nautilus --new-window

  • I’m not sure why you are getting two Exec= entries. That is an error in the desktop file, unless there is more than one [section] in the file. Are you sure you didn’t omit the ^ symbol in the command above and one of those entries is instead TryExec=?

    From here I advise three courses of action:

    1st Assuming the .desktop file is indeed fine and there is only one Exec= entry, the plot thickens and there should be no reason for this to fail. Is Nautilus installed on your system and does it work when you invoke it through other means?

    2nd Locate the System Settings in Gnome (I don’t use it so I don’t know where this is in the GUI). There must be something about Default Applications. Within you may make changes to the default File Manager.

    3rd With the above failing, show me the contents of the file, please: $ cat /usr/share/applications/org.gnome.Nautilus.desktop

opening13 directories2 xdg-open1 Posts 7Views 874
Log in to reply
Bloom Email Optin Plugin

Looks like your connection to Antergos Community Forum was lost, please wait while we try to reconnect.