superfile icon indicating copy to clipboard operation
superfile copied to clipboard

Add option to open files as well as view/edit, with different methods per extension

Open hack-wizard opened this issue 4 months ago • 4 comments

Is your feature request related to a problem? Please describe. If I try to open an image file, like a jpeg or png, or if I try to open/play a video, like an mp4, it will send it to my default (text) editor. This is non-conducive for a file manager and one of the major issues that keep me from moving from Midnight Commander to Superfile.

Also in case you've never heard of it, yes, MPV can totally display images and videos fully, even if your system has no GUI. :)

Describe the solution you'd like Set up an extensions file sort of like Midnight commander does, which allows the file manager to launch different commands relevant to each particular filesystem.

Describe alternatives you've considered Right now I am using mc as this lets me do what I want with one shot configuration adjustments. The only other work-around I can see would be to exit the program every time I want to open a non-text file or run a separate command.

Additional context See an example of how Midnight Commander handles this here: https://github.com/MidnightCommander/mc/blob/master/misc/mc.ext.ini.in

hack-wizard avatar Aug 30 '25 22:08 hack-wizard

@hack-wizard

If I try to open an image file

How do you attempt to open it, by pressing the e key or by pressing the enter key?

And, what happens when you run xdg-open on your image and video files?

lazysegtree avatar Aug 31 '25 03:08 lazysegtree

I tried the enter key, it does nothing at all. If I use e it just uses emacs

The setup in question isn't running x, so xdg-open does not work. What I want is to be able to specify programs to use, like mpv

hack-wizard avatar Aug 31 '25 03:08 hack-wizard

This should be doable though, we could allow an extension mapping in config file. Users can define

.pdf -> xyz .cpp -> abc .mp4 -> mpv

Just curious, how mc does it ?

lazysegtree avatar Sep 01 '25 03:09 lazysegtree

That's set in the extension file, linked here: https://github.com/MidnightCommander/mc/blob/master/misc/mc.ext.ini.in

hack-wizard avatar Sep 01 '25 04:09 hack-wizard