Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show only files of certain MIME types (or generic file/directory filtering) #27

Open
jluttine opened this issue May 6, 2020 · 0 comments

Comments

@jluttine
Copy link

jluttine commented May 6, 2020

In many "normal" applications, they open some file dialog to select a file of a certain type. For instance, "choose an image". Magically, the dialog indeed lists only image files.

I think rofi file browser would be perfect for similar usecases. For this to work, the file browser would need to be able to filter the files somehow. Would it make sense to add a flag like -file-browser-filter-mime-type=image/jpeg,image/png, which accpets, for instance, a comma separated list of MIME types? At least file --mime-type somefile can be used to get the MIME type of a file, but there are certainly many other tools for that. Also, filtering based on extension might be useful.

Another more general option would be to add an option like -file-browser-filter=some_executable for which some filtering executable is given. This filter is run for the list of files (and directories?) that would be in the current view. I don't know what would be the best way to implement it, but one simple solution would be that the executable is assumed to read stdin and print to stdout those paths it wants to keep. This would of course allow arbitrary manipulation of the file names (heck, it can print any number of lines containing whatever to stdout), and that most likely doesn't make sense in many cases, but maybe that can have some unpredictable powerful usecases. But at least it would allow relatively easy implementation of various filters such as the mime type and extension filters I had in mind.

What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant