[Thunar] Opening files via a file manager in their associated programs

Guys, I need some help with Thunar.

If I open a file from terminal with pcmanfm, e.g. like this:

pcmanfm /home/piotr/Obrazy/image.jpg

it opens in feh, which is my default “open with” for .jpg files. I can set this association in both pcmanfm and Thunar. Some time ago it worked for me in Thunar, but it stopped:

thunar /home/piotr/Obrazy/image.jpg

just opens Thunar in the proper path, with the image.jpg file selected. I’m not sure when the behaviour changed. I used to use the thunar-git package, but it stopped building, so I got back to the regular package.

Could you tell me how Thunar behaves on your machines?

Nothing special on my end, if I right-click on a pic in Thunar it states if I want to open it with 3-4 options depending on what installed on my lappy.

What it says into your Thunar s Preferences or Configure custom actions in your Edit section into Thunar.

It might been screwed up after an update of some sorts, shit happens some times.

I must say that I have nothing in order to check if I can open a fil with a terminal from Thunar sadly.

Edit: Is it still Feh that you re using with Thunar also !

Hope that it can be of any help;

https://docs.xfce.org/xfce/thunar/custom-actions

What I actually need it to find out if Thunar behaves this way just for me, or everywhere. Just locate some image, open terminal, and run:

thunar /path/to/the/file.jpg

The question is if it opens Thunar, or feh (or another associated program) with file.jpg opened.

Oh, it stated Failed to open; So you re not alone like that

thunar /path/to/the/file.jpg
Thunar: Failed to open “/path/to/the/file.jpg”: Error when getting information for file “/path/to/the/file.jpg”: No such file or directory

Is that the same results on your end !

Weird, never checked for that before.

LOL! I meant a real path to a .jpg file on your computer. :rofl:

1 Like

lol, it is my friend, bet that my lappy s fooling around with me !

Edit: I don t know its path , never checked I must say.

Never mind. Possibly someone else’s got a .jpg file on their machine.

Hey cool, thought afterward when I saw your response path-wise from my terminal results! I was laughing like hell ! lol

It opened thunar for me - both jpg and png images.

So you’re not alone.

3 Likes

Thanks! Not that it’s something unacceptable, but I remember it behaved differently.

I use this in nwg-drawer to open a file from search results.

1 Like

You could use “xdg-open” instead. Seems that thunar does not follow XDG MIME APPLICATION spec.

1 Like

Sure, but some paths are directories, so I wanted to open them in a file manager. Possibly I could open directories with a file manager, and files with xdg-open. Worth of try.

If you set a default file manager in xdg, “xdg-open” will launch it when URI is a directory. Try,

$xdg-mime default thunar.desktop inode/directory

$xdg-open ~/Documents

This requires properly configured environment. E.g. on my laptop directories open this way in Atom, and most of files in the web browser. :slight_smile:

$xdg-mime query default inode/directory

Yes, I understand. But users would need to configure associations for all the file types. Believe me - most of them will have a problem.

Even if you use pcmanfm or other file managers which handle MIME better, you would still need to configure xdg properly. Most of them are done during installation/system configuration.

1 Like