1

When I click on a file in chromium, it calls xdg-open to open the file based on its mime type.

For example, if I click on a file with a .torrent extension, it opens it in my torrent client.

Is it possible to disable the use of xdg-open, and instead specify which extensions should be opened in which applications?

Nordine Lotfi
  • 2,200
  • 12
  • 45
400 the Cat
  • 819
  • 4
  • 37
  • 85

1 Answers1

0

Changing the defaults application that xdg-open use, and instead specifying your own/preferred one is an easy task, and also doesn't pertain to chromium directly:

  • Using perl-file-mimeinfo or mimeinfo
/usr/bin/vendor_perl/mimeopen -d $file.ext

which will then open a prompt where you can place the name of the wanted application, that you want to open it with.

  • Using xdg tooling
xdg-mime default Thunar.desktop inode/directory

You can look into your MIME database on ~/.local/share/applications/defaults.list or ~/.local/share/applications/mimeapps.list to see existing entries (you can edit them, but i don't recommend to) and check what you want to change.

Refer to the Archwiki for more information.

Do remember that application assigned with xdg/or other method can overlap. So be wary by first running xdg-mime query default protocol/filetype first, or by looking into the previously mentioned MIME database directories.

Nordine Lotfi
  • 2,200
  • 12
  • 45
  • I am not asking how to change `xdg` default application. I am asking how to launch application directly from chromium, without using `xdg` – 400 the Cat Sep 10 '20 at 11:58
  • So you basically want to do like what `firefox` does, and set the default application per filetype directly in chromium, without relying on `xdg`? – Nordine Lotfi Sep 10 '20 at 18:54
  • I just thought i would give an alternative, since `xdg` is pretty much anchored in Linux ecosystem, and while it's true that it's not the most documented piece of software, _it is_ easier to use than it look like. – Nordine Lotfi Sep 10 '20 at 18:55
  • exactly. I want to do like what firefox does, and set the default application per filetype directly in chromium, without relying on xdg – 400 the Cat Sep 11 '20 at 06:33