leo-arch / clifm

The shell-like, command line terminal file manager: simple, fast, extensible, and lightweight as hell.
https://github.com/leo-arch/clifm/wiki
GNU General Public License v2.0
1.33k stars 40 forks source link

Can't open multiple files in selection #187

Open Iduoad opened 1 year ago

Iduoad commented 1 year ago

Describe the bug I can't open all the files in a selection, is there a way to do that or is it impossible as for now ?

To Reproduce Steps to reproduce the behavior:

s *.pg
o sel
clifm: open: /home/user/Desktop/file.png: Permission denied # this is the second file in selection
leo-arch commented 1 year ago

Hi @Iduoad. Thanks for your feedback.

As of now, it is not possible to open multiple files at once: the second parameter, if any, is taken as an opening application (and since yours is a regular file, clifm spits out a Permission denied error).

I guess adding multi-open support for the open function would be a nice improvement. For the time being, a proper error message will be added to let the user know the cause of the error.

Iduoad commented 1 year ago

Thank you for the awesome work @leo-arch

leo-arch commented 1 year ago

Proper error message added.

leo-arch commented 1 year ago

Hi @Iduoad. Though we don't have multi-open right now (and I'm still not sure about this feature), there's still a workaround to get more or less what you want:

  1. Select the desired files, say, s *.png
  2. Open these files with the desired application, say: sxiv sel (then use n and p to navigate through your images)

Note: Of course, it depends on the application whether or not it can handle multiple files at once (and what file types it can handle)

Note 2: sel is not the only way. If you've tagged files as images, you can issue: sxiv t:images. You can also group files by MIME type, for example: sxiv @image.

True, the auto-open function is lost here, but it pretty much does the trick.

Hope it helps.

Slackadays commented 1 year ago

@leo-arch I have an idea of how to fix this. What if you checked any paraneters after the first and see if they're an application or file? If it's a valid program, then use that to open the file, but if it isn't, consider it a selected file instead. That way, you can have you cake and eat it too, as you now can specify an application to open a single file with, automatically open two or more files, or specify application(s) to open one or many files. Basically, you open all files with all applications provided with clifm automatically determining what to use when you run the command.

leo-arch commented 1 year ago

Basically, it is already working that way, except that only for single files. For example, FILE will open FILE with the default application, whereas FILE APP will open FILE with APP.

The thing is to make it work with multiple files. This is already in my TODO list. Version 1.11 will be released in a few days, so, maybe for the next release.

Slackadays commented 1 year ago

I was thinking the killer feature would be to have it available in the format of FILE FILE APP APP where you can have each APP open both FILEs and handle any combination of that. Taking it further, FILE APP APP APP or FILE FILE FILE APP APP APP APP because I can think of a couple workflows where you want multiple things to handle multiple items at the same time. In that way, clifm acts completely generically and doesn't put you into a box of one app only.

leo-arch commented 1 year ago

That would be nice indeed.

Docbroke commented 1 year ago

This is nice but complicated. How clifm will know, which of the given argument is APP and which one is FILE ? It will require clifm to check every argument. Even more trouble if current directory is in $PATH, where every argument will be FILE in current path as well as APP

Slackadays commented 1 year ago

It will require clifm to check every argument.

That was kind of the point, so that clifm does the hard work for us so the user doesn't have to.