clifm icon indicating copy to clipboard operation
clifm copied to clipboard

Can't open multiple files in selection

Open Iduoad opened this issue 2 years ago • 10 comments

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

Iduoad avatar Feb 04 '23 17:02 Iduoad

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.

leo-arch avatar Feb 04 '23 18:02 leo-arch

Thank you for the awesome work @leo-arch

Iduoad avatar Feb 04 '23 20:02 Iduoad

Proper error message added.

leo-arch avatar Feb 05 '23 07:02 leo-arch

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.

leo-arch avatar Feb 05 '23 21:02 leo-arch

@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.

Slackadays avatar Mar 18 '23 23:03 Slackadays

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.

leo-arch avatar Mar 18 '23 23:03 leo-arch

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.

Slackadays avatar Mar 19 '23 00:03 Slackadays

That would be nice indeed.

leo-arch avatar Mar 19 '23 00:03 leo-arch

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

Docbroke avatar Apr 08 '23 01:04 Docbroke

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.

Slackadays avatar Apr 08 '23 02:04 Slackadays