-
Notifications
You must be signed in to change notification settings - Fork 37
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
Allow sorting on size #479
Conversation
By default we sort files from large to small and then show folders.
case "size": | ||
return (a, b) => compareFileType(a, b) === 0 | ||
? (a.size > b.size | ||
? -1 | ||
: 1) | ||
: compareFileType(a, b) * -1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These 6 added lines are not executed by any test.
Folders first always, then sorting in each group (folders vs. files). If you want to know what Nautilus does, it counts the # of immediate children items (that is: just 1 level, non-recursively) in a folder as "size". |
I wonder if we might want to split size into 2 sort types: "Size, largest first" and "Size, smallest first". Other options have reversing, whereas size doesn't in our mockups (currently) and in Nautilus. Generally, you'd usually want largest first (which is what Nautilus does when you select "Size"). |
For me, nautilus sorts files first from large -> small and then shows folders. So we deviate then if we show folders first
Not for me, it does not sort the folders at all on size. |
That sounds sensible. Actually if I use the folder view in nautilus it does not allow me to change the sorting at all: Only in the list view I can: |
Yeah, it's sort of weird that size isn't swappable in Nautilus, except in list view. (Type also isn't, but I don't know why someone would want to do a reverse sort by type.) I guess large files are almost the only thing people care about? It's usually true that you care about the larger files, to remove them to free up space, to find the ones with the most content (and therefore relevance). Once in a while, I guess sorting with smallest first makes sense, such as if you're looking to move or delete MP3s in a directory with both MP3s and Flac, or text files mixed into a directory with images (or any type), or so on. I'm grasping at straws for examples. 😉 I guess the uses are kind of small, and Nautilus assumes you can "just" scroll to the bottom of the folder. It just sort of feels weird to have reversible alphanumeric sorting and reversible modify time sorting and not have size reversible too. Perhaps it's because it's a little clunky compared to the rest? "A-Z" vs. "Z-A" is straightforward. "Last modified" to "First modified" also makes sense. I supposed we'd want to have the designation first, like "Largest size" and "Smallest size"? |
My thinking, when I sort it is a lot more natural to use a list view.
But what about the filetype sorting? Do we replicate nautilus behavior of showing the biggest (or smallest) files first and then folders? |
Sorting by type is:
That's what Nautilus does, and it makes sense. Nautilus has the mapping of types @ https://gitlab.gnome.org/GNOME/nautilus/-/blob/main/src/nautilus-mime-actions.c#L100-259 Here's the same thing in a JSON object{
"Files": [
"application/octet-stream",
"text/plain",
"text/markdown"
],
"Folders": [
"inode/directory"
],
"Documents": [
"application/rtf",
"application/msword",
"application/vnd.sun.xml.writer",
"application/vnd.sun.xml.writer.global",
"application/vnd.sun.xml.writer.template",
"application/vnd.oasis.opendocument.text",
"application/vnd.oasis.opendocument.text-template",
"application/x-abiword",
"application/x-applix-word",
"application/x-mswrite",
"application/docbook+xml",
"application/x-kword",
"application/x-kword-crypt",
"application/x-lyx",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"text/markdown"
],
"Illustration": [
"application/illustrator",
"application/vnd.corel-draw",
"application/vnd.stardivision.draw",
"application/vnd.oasis.opendocument.graphics",
"application/x-dia-diagram",
"application/x-karbon",
"application/x-killustrator",
"application/x-kivio",
"application/x-kontour",
"application/x-wpg"
],
"Music": [
"application/ogg",
"audio/x-vorbis+ogg",
"audio/ac3",
"audio/basic",
"audio/midi",
"audio/x-flac",
"audio/mp4",
"audio/mpeg",
"audio/x-mpeg",
"audio/x-ms-asx",
"audio/x-pn-realaudio"
],
"PDF / PostScript": [
"application/pdf",
"application/postscript",
"application/x-dvi",
"image/x-eps",
"image/vnd.djvu+multipage"
],
"Picture": [
"application/vnd.oasis.opendocument.image",
"application/x-krita",
"image/bmp",
"image/cgm",
"image/gif",
"image/jpeg",
"image/jpeg2000",
"image/png",
"image/svg+xml",
"image/tiff",
"image/x-compressed-xcf",
"image/x-pcx",
"image/x-photo-cd",
"image/x-psd",
"image/x-tga",
"image/x-xcf"
],
"Presentation": [
"application/vnd.ms-powerpoint",
"application/vnd.sun.xml.impress",
"application/vnd.oasis.opendocument.presentation",
"application/x-magicpoint",
"application/x-kpresenter",
"application/vnd.openxmlformats-officedocument.presentationml.presentation"
],
"Spreadsheet": [
"application/vnd.lotus-1-2-3",
"application/vnd.ms-excel",
"application/vnd.stardivision.calc",
"application/vnd.sun.xml.calc",
"application/vnd.oasis.opendocument.spreadsheet",
"application/x-applix-spreadsheet",
"application/x-gnumeric",
"application/x-kspread",
"application/x-kspread-crypt",
"application/x-quattropro",
"application/x-sc",
"application/x-siag",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
],
"Text File": [
"text/plain",
"text/markdown"
],
"Video": [
"video/mp4",
"video/3gpp",
"video/mpeg",
"video/quicktime",
"video/vivo",
"video/x-avi",
"video/x-mng",
"video/x-ms-asf",
"video/x-ms-wmv",
"video/x-msvideo",
"video/x-nsv",
"video/x-real-video"
]
} I think we can do better though. Many of the mimetypes make sense; we can probably abstract some by searching the beginning of the mimetype string; for example, these match Picture: The easiest is probably just matching the first part of the mimetype in a first pass and extend it later. |
By default we sort files from large to small and then show folders.
@garrett how do I change the sorting on size? The default is Big to small files and then folders
Do I have to click again on
size
to change the sorting to small -> big?