Skip to content

Show real dimensions and paths in the clip card footer - #95

Open
alvst wants to merge 1 commit into
momenbasel:mainfrom
alvst:alvie/pr-25-clip-card-metadata
Open

Show real dimensions and paths in the clip card footer#95
alvst wants to merge 1 commit into
momenbasel:mainfrom
alvst:alvie/pr-25-clip-card-metadata

Conversation

@alvst

@alvst alvst commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

The card footer's "Image" and "1 file" tell you nothing the card itself doesn't already show. Image clips now read their pixel dimensions, and file clips say which files they actually point at.

What changed

  • Image clips show pixel dimensions — 1920 × 1080 — instead of the word "Image".
  • A file clip pointing at an image also shows dimensions; a screenshot's path is a timestamped folder nobody reads, and the image is already visible on the card.
  • Every other single-file clip shows its full location, ~-abbreviated, because two documents of the same name differ only by where they live.
  • Multi-file clips list every filename instead of a bare "N files" count, which named none of them.
  • The meta line wraps to three lines for file clips rather than ellipsizing; every other type stays on one line. The footer row aligns on its bottom edge so the quick-paste hint stays put as the path grows.

Screenshots

Before:
00-baseline screenshots bar.png

After:
14-clip-card-metadata screenshots after.png

Notes for review

  • The footer is evaluated on every render, so it never touches disk to answer a question it's asked constantly: whether a file is an image is decided from its path extension, and dimensions come from image metadata via CGImageSourceCopyPropertiesAtIndex (never a decode), cached by path.
  • Graceful fallbacks: a missing or unreadable image file falls back to the old "Image" label; an image file whose size can't be read falls back to its filename.
  • No dependencies. It touches the same file as alvie/pr-26-paste-style-cards, but the two use differently-named, differently-typed helpers on purpose (isSingleImageFile returning Bool here, singleImageFileURL returning URL? there), so they can merge in either order with no redeclaration.

This feature should be bundled into v2.

Part of #80.

The footer's "Image" and "1 file" told you nothing you couldn't
already see from the card itself. Image clips now read their pixel
dimensions - "1920 × 1080" - and file clips say which files they
actually point at.

What a file clip's footer says depends on what the file is. An image
already shows what it is by sitting on the card, so its dimensions are
the useful fact - a screenshot's path is a timestamped folder nobody
reads. Everything else gets its full location instead, abbreviated
with "~", because two documents of the same name differ only by where
they live. Multi-file clips list every filename rather than a bare
"N files" count, which named none of them. Whether a file is an image
is decided from its path extension, never by opening it: the footer is
evaluated on every render, so it must not touch disk.

A path is worth reading in full, so the meta line wraps to three lines
for file clips rather than collapsing to an ellipsis; every other type
stays on one line. The footer row aligns on its bottom edge so the
quick-paste hint stays put as the path grows.

Dimensions come from the image file's metadata via CGImageSource
rather than from decoding it, and are cached by path: the footer asks
on every render, so a decode per card would be paid over and over for
a number that never changes. Clips whose image file is missing or
unreadable fall back to the old "Image" label, and an image file whose
size can't be read falls back to its filename.
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

Successfully merging this pull request may close these issues.

1 participant