Skip to content

Thumbnails: pictures in rows, sturdier thumbnailers - #67

Closed
dhh wants to merge 17 commits into
raw-thumbnailsfrom
thumbnail-rows
Closed

dhh wants to merge 17 commits into
raw-thumbnailsfrom
thumbnail-rows

Conversation

@dhh

@dhh dhh commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

By GM (@thisisgm), from #50: the work and the description below are theirs, with their commits kept as they made them. It's stacked on #66 (their #17 with its review fixes), and this pull request carries it on from our own branch, with the fixes from review added on top.

Four changes to thumbnails, one commit each with its own tests: a row in the list and the columns shows the picture its tile shows, a file whose name holds a thumbnailer code reaches the thumbnailer as it is, a failure is remembered only when the file itself was judged, and a thumbnailer past its time is stopped together with what it started. No library, depends or optdepends entry is added.

What you'd notice

  • Rows show the pictures tiles show. The list and the columns asked for a thumbnail only for a photo or a video, so a PDF, a song with a cover or an office document had its picture in the grid and an icon in a row. A row now asks for every picture a tile shows, except a text file's page, which says nothing at a row's size. A page or a cover is fitted whole in the row, where a photo is still cropped to fill it.
  • A file called 50%off.mp4 gets its thumbnail. A thumbnailer's Exec line was filled in one code after another, so the %o in the file's own name was replaced by the output path. The thumbnailer was sent a file that is not there and the failure was remembered. Each code is now read once, in one pass, and %% is a percent sign as the spec says.
  • A failure is remembered only when the file was judged. A failure marker keeps every app from trying a file again. One was written when the thumbnailer never started, when a spec's program was not installed, when the file could not be read, and when it was moved away or written to during the run. None of those says the file is broken, so none is remembered now. A spec whose Exec program is gone is no longer taken as a thumbnailer, so the details pane still names the package that would draw the type, and a PDF whose thumbnailer cannot start is left to pdftoppm.
  • A hung thumbnailer does not leave programs behind. A thumbnailer still running after 15 seconds was killed alone, so the programs it had started (glycin and the office thumbnailer start their own) ran on. Each thumbnailer now runs in a session of its own under a small keeper process. The session is stopped whole when the time is up, and also when Folio itself is gone, where a terminal's Ctrl-C no longer reaches it.

Numbers

Measured on a mini PC, cold start, six runs a view, on a folder of 2,000 pictures and videos. These runs are from the rows commit before the rebase onto the current main, against the main of that day. The keeper adds one fork to each thumbnailer run; that is not in these numbers yet.

View main this branch
Grid 4446 to 4627 ms, 153.6 to 154.2 MiB, 105 thumbnails 4455 to 5490 ms, 151.6 to 154.6 MiB, 105 thumbnails
List 2872 to 3203 ms, 127.9 to 129.8 MiB, 52 thumbnails 2960 to 3253 ms, 129.0 to 129.6 MiB, 52 thumbnails
Columns 3016 to 3494 ms, 142.5 to 146.2 MiB, 52 thumbnails 3063 to 3457 ms, 143.8 to 147.0 MiB, 52 thumbnails

A folder of photos and videos asks for the same thumbnails as before, and the ranges overlap in every view. A folder of PDFs or music now draws its rows' pictures, which costs what the grid already paid for them.

Screenshots

The same folder in the list, main on the left and this branch on the right: the song shows its cover and the PDF its first page.

List rows before and after

Changed in review

  • Quitting never waits on a thumbnailer. A run now waits in short slices against one deadline for start and finish together, and stops at once when Folio quits, instead of holding the quit for up to 15 seconds. A run stopped that way remembers no failure.
  • What a thumbnailer leaves behind is stopped after every run, not only after a timeout, so a helper it started in the background doesn't live on in its own session.
  • A larger thumbnail serves a smaller row. Going from the grid to the list scales the grid's fresh thumbnail down instead of running the thumbnailer again.
  • The process tests count a killed helper left as a zombie as ended, so they hold in CI containers, and a failure is remembered on one condition.

Reviewed with Codex.

🤖 Generated with Claude Code

thisisgm and others added 15 commits November 11, 2026 12:58
Failure markers went to fail/folio, so a file Folio could not
thumbnail stayed blank after it learned to, as it does for camera RAW
here. They now go to the spec's fail/<program>-<version>, as
fail/folio-2: the number is raised whenever Folio learns to draw more.
A thumbnailer that names a type only by an alias never matched the
canonical name Folio asks with, so glycin's image/x-dds left a DDS
file blank. The declared types are resolved to canonical names once,
when the thumbnailers are read.
A CR2, NEF, NRW, ARW, SR2, DNG or PEF showed a blank tile unless a RAW
thumbnailer was installed. The camera stores a finished JPEG in each,
and a bounded reader of the TIFF directories now finds the largest
one. An installed thumbnailer still answers first.
A type with no installed thumbnailer showed a blank tile and nothing
else. The details pane now says which optional package draws it, from
the types ffmpegthumbnailer, papers, glycin and libgsf declare.
A file nothing installed could draw kept its failure marker, so a
thumbnailer installed afterwards never ran for it. The marker now
records the thumbnailer the type had, none included, and holds the
file back only while that is unchanged.
One orientation was kept for the whole file, so a preview whose
directory names a turn of its own was turned by IFD0's instead. Each
embedded JPEG now carries its directory's orientation, and takes the
file's only when its directory names none.
With Poppler installed and no PDF thumbnailer, a PDF that failed to
draw (damaged, or locked with a password) had the details pane name
papers as missing. A PDF's package is now named only when pdftoppm is
not there either.
The list and the columns asked for a thumbnail only for a photo or a
video, so a PDF, a song with a cover or a document had its picture in
the grid and an icon in a row. A row now asks for every picture a tile
shows but a text file's page, which says nothing at a row's size, and
a page or a cover is fitted whole in the row where a photo is cropped.
A thumbnailer's command was filled in one code after another, so a
file called 50%off.mp4 had the %o in its own name replaced by the
output path. The thumbnailer was sent a file that is not there, and
the failure was remembered. Each code is now read once.
A failure marker keeps every app from trying a file again, and one was
written for a thumbnailer that never started, for a spec whose program
is not installed, for a file that could not be read and for one moved
away or written to during the run. None of those says the file is
broken, so none is remembered now, and a PDF whose thumbnailer cannot
start is left to pdftoppm.
A thumbnailer still running after 15 seconds was killed alone, so the
programs it had started (glycin and the office thumbnailer start their
own) ran on. Each now runs in a session of its own, under a keeper that
stops the whole session past its time, and when Folio itself is gone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Whether a failed run is remembered now reads as one condition. The new
thumbnailer tests use the ended() helper main already has, which counts
a zombie as ended, in place of a second copy of it. A .thumbnailer file
is called that rather than a spec, as on the RAW branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…er thumbnails

Folio waits for the thumbnails being made as it quits, so a hung
thumbnailer kept it running in the background for up to 15 s. Thumbnails
now has quit(), called on aboutToQuit, and run() waits in short slices
so it stops the helper at once; a file stopped that way is not marked
as failed. Start and finish share one deadline instead of each getting
the full patience.

A thumbnailer that exits while something it started in the background
still runs no longer leaves that behind: its session is killed after
every run, not only after a timeout.

Rows ask for 128 px and tiles for 256 or 512, so a folder seen as tiles
and then as rows ran every thumbnailer twice. load() now scales down a
fresh thumbnail from a larger bucket before making one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new actionable issue was found.

Summary

Rows now request the same thumbnails as tiles, except text pages. Thumbnail commands expand percent codes once, and failure markers are saved only after a file was judged.

  • Rows now show pictures for more than photos and videos.
  • Thumbnailer commands keep percent signs inside file names intact.
  • Folio skips thumbnailer entries whose program is missing.
  • Failure records now mean a thumbnailer actually judged the file.
  • Thumbnailer runs and their helpers stop when Folio quits or the run ends.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Row or tile requests a thumbnail] --> B{Fresh cache entry?}
  B -->|Yes| C[Return picture at requested size]
  B -->|No| D[Try reader or thumbnailer]
  D --> E{Thumbnailer started?}
  E -->|No| F[Try PDF fallback when available]
  E -->|Yes| G[Wait in short slices]
  G --> H[Stop leftover helpers]
  H --> I{Picture available?}
  I -->|Yes| J[Save thumbnail]
  I -->|No| K[Save failure only if judged and unchanged]
Loading

Reviews (2) · Last reviewed commit: "Give older failures another try, and sto..." · Reviewed by Greptile

Comment thread src/thumbnails.cpp Resolved
Comment thread src/thumbnails.cpp Resolved
dhh and others added 2 commits November 11, 2026 19:20
@dhh

dhh commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

Thank you @thisisgm, this was careful work. Its "rows show pictures" part already landed as #149, and the rest has been taken into focused pull requests off today's main, each crediting you:

What isn't carried on: the stop-on-quit and keeper-after-Folio-dies machinery, reusing a larger cached bucket, and the RAW branch merges (those are handled from #66). Closing this in favor of those PRs.

@dhh dhh closed this Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants