lsd
lsd copied to clipboard
Add support for file category sort
Enhancement of https://github.com/Peltoche/lsd/pull/413
The problem
Currently, if you have media files such as .mkv, .mp4, and .webm they won't appear together but instead be spread out.
Same for .jpg and .png which is pretty annoying.
Proposed solutions
Sort by icon
An easy improvement would be to sort on (icon, extension) as currently many file types belonging to the same category have the same icon (e.g. .mp4, .mov, .mkv).
Sort by mime type
An alternative would be to rely on the mime media types but it's far from perfect:
- Some file types are in several categories, with some that don't make sense.
- e.g. mp4 is
application/mp4,audio/mp4, andvideo/mp4
- e.g. mp4 is
- The granularity is poor. There are only 10 categories:
application,audio,font,example,image,message,model,multipart,text, andvideo.
Sort by custom category definitions
A better improvement would be to embed a simple hierarchical category system, where formats are put in the category that makes the most sense. The ordering would be on the key (category, extension).
For example it could look like that:
video:
compression: [h264, h265]
container: [avi, mp4, mkv]
audio:
compression: [aac, opus, mp3, wma]
container: [ogg, wav]
text:
plain: [txt, log]
formatted: [md]
code:
system: [c, cpp, go]
web: [html, js, css]
script: [py, sh]
Etc.
This is an interesting idea, but as you said, not sure what would be the best way to categorize things. Doing by icons can become messy as we might have custom image formats with separate icons (like things from Adobe). Doing it by mime sounds like an interesting option but we might miss out of some useful ones like document(pdf, docx).
I really like the idea of Sort by custom category definitions. LSD could provide a default category definition and users can create their own in .config/lsd/ to extend/overwrite the default one if they want.
+1
I have too much on my plate right now, otherwise I would love to do a PR. Anyone would like to step in? 🙏