Skip to content

feat: gallery mode and exif data in photo view! - #93

Merged
IAmJSD merged 56 commits into
mainfrom
t3code/picasa-lightroom-gallery-mode
Sep 2, 2026
Merged

IAmJSD merged 56 commits into
mainfrom
t3code/picasa-lightroom-gallery-mode

Conversation

@IAmJSD

@IAmJSD IAmJSD commented Sep 2, 2026

Copy link
Copy Markdown
Member

No description provided.

IAmJSD and others added 30 commits September 1, 2026 03:06
A new desktop-only gallery: watch folders of photos in place, browse
them Picasa-style (folder sidebar, white grid under blue per-folder
headers, bottom tray with the green Edit button and a size slider),
and import from mounted cameras by their DCIM volumes. Booting with
nothing to open lands in the gallery when one exists, and on a new
start screen (File > New presets, Open, recents, gallery setup)
otherwise. Ctrl/Cmd+Shift+G opens the view from anywhere, and while
it is up the menu bar swaps to the gallery's own menus.

Editing never touches the original file: a photo opened from the
gallery saves to a hidden PSD sidecar beside it, every save first
copies the previous sidecar into a timestamped versions/ directory,
and the grid renders edited photos from their sidecar with an
"edited" badge. Thumbnails come from schist-preview on the background
executor with a PNG disk cache keyed by path and mtime.

The whole subsystem is compiled out of the wasm build, with its menu
entries filtered like the other desktop-only features.

Co-Authored-By: Claude Fable 5 <[email protected]>
…white

The gallery kept Picasa's white lightbox whatever the editor theme, so
opening it from a dark editor was a flashbang. It now keeps its own
quieter palette but picks it by theme: light keeps the warm Picasa
white, dark gets a Lightroom-grey version of the same room. The
thumbnail-size slider draws on the gallery palette too, rather than
importing the editor theme's near-black track onto the tray, and an
empty scan now says no photos were found (and what counts as one)
instead of showing a bare grid.

Co-Authored-By: Claude Fable 5 <[email protected]>
With no camera volume mounted, Import… wrote its answer to the status
line — which the gallery hides — so the button read as broken. No
sources now opens the picker dialog in an empty state that says what
counts as a camera (a mounted disk with a DCIM folder; PTP phones
don't qualify) with a Scan Again button, and the tray now carries the
status line so import progress and outcomes land somewhere visible.

Co-Authored-By: Claude Fable 5 <[email protected]>
…were taken

Camera detection now looks past plain disk mounts: GVFS mounts count
(afc: iPhones, gphoto2: PTP cameras, mtp: Android — how a phone
appears as files on a Linux desktop), DCIM may sit one storage-folder
down as MTP presents it, and volumes get human labels instead of GVFS
URLs. macOS iPhones still cannot mount as a filesystem; the no-camera
dialog explains the Image Capture / AirDrop route.

Picking a source now opens an options dialog instead of importing on
the spot: choose "Anywhere" or a named place ("taken in New York"),
and only photos whose EXIF GPS position falls inside that place's
bounding box import — into ~/Pictures/Schist Imports/<place>, so the
filter names the folder. The dialog draws the box on a genuine
OpenStreetMap rendering: raster tiles from tile.openstreetmap.org,
fetched with an identifying User-Agent, cached beside the thumbnails,
attributed under the map. EXIF comes from kamadak-exif (pure Rust;
JPEG/TIFF/HEIF/PNG).

Co-Authored-By: Claude Fable 5 <[email protected]>
A JPEG whose APP1 says Times Square, byte by byte, so photo_gps is
tested through the real kamadak-exif parse — DMS conversion, the W
hemisphere flip, and that the result lands inside the New York box.

Co-Authored-By: Claude Fable 5 <[email protected]>
…ureCore

Those devices never mount as filesystems, so the DCIM-volume scan
cannot see them. A new library_icc module knocks on the door Image
Capture and Photos use: one delegate class assembled with the ObjC
runtime's class builder (the Quick Look providers' idiom — no
Objective-C source, no Xcode), serving as device-browser, camera and
download delegate at once. Connected devices appear beside mounted
volumes in the import picker under an ImportSource enum shared by both
kinds; downloads run through requestDownloadFile with per-file
completion, a passcode-locked iPhone is reported in the tray rather
than hung on, and the place filter applies to each file as it lands —
a device offers no way to read EXIF without downloading, so a declined
photo is downloaded, inspected and removed.

Typechecked and clippy-clean for aarch64-apple-darwin (the module is
self-contained, checked standalone; the workspace itself cannot cross-
check from Linux past ring's C build) — but not yet run against real
hardware: this commit is for testing on a Mac with an iPhone.

Co-Authored-By: Claude Fable 5 <[email protected]>
cameraDevice:didReceiveThumbnail:forItem:error: and its metadata twin
carry four selector arguments; both were registered with a three-
argument no-op, and objc2 asserts the count when the class is built —
which is the moment Import is first clicked, as Astrid found. Every
registration is now mechanically recounted. Gallery-at-boot also goes
through toggle_gallery, so camera discovery starts with the gallery
rather than waiting for the first click.

Co-Authored-By: Claude Fable 5 <[email protected]>
Astrid's ask: the import filter should be a fully navigable, web-like
map where the boundary is drawn, not chosen off a list. The options
dialog now holds a real slippy map — OSM raster tiles painted the way
the document canvas paints (one quad per visible tile, laid out in the
canvas prepaint, fetched on demand through the disk cache), drag to
pan, wheel to zoom about the pointer with touchpad debt so a flick is
one step, Shift-drag or a Draw button to set the boundary, and the
city presets reduced to jump chips that frame their box. The filter
plumbing moves from PLACES indices to a GeoBounds carried with its
display name; the boundary lives on the library so it survives the
dialog closing. New tests pin the mercator round-trip, drawn-box
normalization from any corner, zoom-at-cursor anchor stability, and
preset framing.

Co-Authored-By: Claude Fable 5 <[email protected]>
Removals announce themselves as "moreGoing", not "moreComing" —
Apple's asymmetry, my transcription — so unplugging an iPhone was an
unrecognized-selector abort; the delegate now registers the spelling
ImageCaptureCore actually calls. A device import that cannot finish
(a locked iPhone, mostly) opens a dialog with the way forward and a
Try Again that keeps the source and boundary, instead of whispering
into the tray. The dialog's tool row no longer collides with the
attribution — that now rides the map's own corner, the way every web
map carries it. And imports show up live: the destination joins the
gallery when the import starts and a rescan ticks while it runs, so
photos appear in the grid as they land rather than all at the end.

Co-Authored-By: Claude Fable 5 <[email protected]>
The missing previews were iPhone photos: schist-preview never knew the
dlopen'd libheif path, so every HEIC thumbnail failed. It decodes them
through the HEIF codec now, the gallery raises the existing managed-
download offer once when thumbnails fail for want of libheif, and the
failed ones retry after it installs (staying in the gallery rather
than opening a file, when that is where the ask came from).

The content filter: Preferences ▸ Gallery gains "Hide photos the
content filter flags as explicit" (off by default). The judgement
comes from a new catalogue model — the NSFWJS MobileNet (Infinite Red
/ GantMan, MIT), 17 MB, revision-pinned and hash-verified, fetched
under Manage Models like any other. Each photo is scored once on its
thumbnail as it loads (hentai+porn+sexy softmax against 0.7), cached
beside the thumbnail, and the tray counts what the filter is hiding.
Without the model nothing is flagged, and the preference says so.

The neural crate learns two things classifiers need: channels-last
input, detected from the graph's declaration (TensorFlow conversions
keep NHWC), and Model::run_scores for a flat float output. Exporter
shape hints on intermediate values are dropped at load — symbolic
batch/height/width fought the concrete input fact. Verified end to
end here: the real loader ran the real model through the new
examples/classify (a synthetic gradient scores as "drawing", plasma
as "neutral", ~80 ms a picture under tract).

Co-Authored-By: Claude Fable 5 <[email protected]>
Astrid couldn't find a way in, and on macOS there barely was one: the
gallery never put the focus handle in the element tree, so ⌘K (and
every other binding) fell on deaf ears, and the gallery's View menu —
whose only item macOS relocates to the application menu — converted to
an empty menu. The gallery root now tracks focus like the canvas does,
the top strip gains a Settings… button, the native bar drops menus
that convert to nothing, and the Gallery menu gains Manage Models… so
turning the content filter on never requires leaving the room.

Co-Authored-By: Claude Fable 5 <[email protected]>
…verflow

The long checkbox label ran past the Preferences dialog's edge, and a
switch that silently does nothing without its model was a lie waiting
to be believed. The row is now "Hide flagged photos", disabled (faint,
listening to nothing, but honest about the stored value) until the
Content (NSFW Filter) model is installed, with the warning above it
saying what to download and a link that opens Manage Models directly —
keeping whatever Preferences changed on the way out.

Co-Authored-By: Claude Fable 5 <[email protected]>
…era roll

Astrid's 1800-photo import showed one thumbnail and 41-of-45 scored
photos "hidden by the content filter". Two causes. Thumbnails: each
batch decoded its four full-resolution HEICs sequentially in one task,
with a classifier pass on each, against a disk busy importing — the
batch now runs one task per decode across the executor's threads (and
is larger), so it costs its slowest member. And a photo whose first
decode ran while the file was still landing stayed Failed forever;
thumbnail states are now tagged with the mtime they were built from,
so a file that changed underneath loads again.

Flagging: the verdict summed the "sexy" class in, and on a real camera
roll — people, beaches, shoulders — that flagged nearly everything.
The rule is now the nsfwjs guidance: porn+hentai past 0.5, or a
near-certain (0.9) sexy. The score cache moves to a new suffix so the
old blended verdicts rot unread, and a test pins that ordinary photos
of people stay visible.

Co-Authored-By: Claude Fable 5 <[email protected]>
Type "dog on a beach" into the gallery's new search box and the grid
becomes one strip ranked by similarity. Every photo is embedded into
512 dimensions as its thumbnail processes, and when nothing on screen
wants a thumbnail the loader spends its idle time indexing the rest of
the library; vectors are cached beside the thumbnails and held in
memory, where ranking a query is a dot product over the lot — at
gallery scale the "vector database" a loop deserves. Results update
per keystroke, Escape clears, scores below 0.15 are dropped, and the
box doubles as the index's progress meter.

The towers are MobileCLIP-S0's, chosen by racing the candidates under
tract: its convolutional image encoder embeds in ~200 ms where a
same-size ViT took eight seconds, and its text tower — mostly a
vocabulary table — answers in ~70 ms. Both join the model catalogue
("Search (Image/Text Embeddings)", revision-pinned, hash-verified).
The neural crate gains Input::Tokens for text towers, run_token_scores,
and a from-scratch CLIP byte-level BPE tokenizer whose output is
pinned test-by-test against the reference implementation; the vocab
and merges ride in the binary, extracted from the model's own
tokenizer.json. Verified end to end here: through the new
examples/embed, "an orange sunset sky" / "green trees in a forest" /
"the deep blue ocean" each rank their matching test image first.

Co-Authored-By: Claude Fable 5 <[email protected]>
…taken

A query that names somewhere now also matches photos by their EXIF
position, fuzzily on both ends. The name side: every one- to three-
word window of the query runs against an embedded gazetteer (GeoNames
cities of 100k+ people plus aliases like nyc/sf/vegas, a quarter-
megabyte in the binary, CC-BY 4.0) — exact, by prefix ("san fran"),
or within a typo or two ("new yrok"); longer windows and better
matches win, population breaks ties so "paris" is France's before an
arrondissement. The photo side: each photo's GPS is read from its
EXIF during indexing and cached beside the thumbnail ("none"
included, so positionless rolls are probed once).

A resolved place adds a distance-faded boost — full inside the city's
population-scaled radius, gone by three radii — blended with the
semantic cosine, so "dog in new york" reads both ways; the results
header names the place it understood, and location-only search works
even before the embedding models are downloaded, so the search box no
longer gates on them.

Co-Authored-By: Claude Fable 5 <[email protected]>
The start screen is gone. A launch with nothing to open lands in the
gallery, empty or not — an empty one already offers the ways in — and
only a shell/Finder path or crash-recovered tabs go to the editor
instead. What the screen carried moves where it belongs: the preset
cards become the File > New popup (a card creates on the spot,
Custom... opens the full dialog, everywhere including the gallery's
New File... button), Open... joins the gallery's top strip, and the
recents move under File > Open Recent in both menu sets, rebuilt into
the macOS bar when they change.

Co-Authored-By: Claude Fable 5 <[email protected]>
⌘A selects the whole query — drawn as a selection, replaced by the
next keystroke, cleared by backspace — and ⌘C/⌘X/⌘V do what they say,
with a pasted paragraph flattened to one line. A click lands a caret,
not a selection, and Enter and Escape clear the selection with the
rest of their work.

Co-Authored-By: Claude Fable 5 <[email protected]>
The sidebar gains Group by chips. Date is the new default — capture
months, newest first, because a camera roll is a diary before it is a
directory tree — with Folder keeping the old arrangement and Place
grouping by the nearest gazetteer city to each photo's EXIF position
(the largest within 60 km, so Manhattan photos say "New York City",
not "Upper West Side"). Capture time comes from DateTimeOriginal,
normalized to text that sorts chronologically without a calendar, with
the file's clock as fallback; time, position and city are read in one
EXIF pass per photo and cached beside the thumbnail, replacing the
gps-only cache. The choice persists in library.json, the folder list
keeps filtering in every mode, the content filter applies whatever
the grouping, and civil-date math is pinned against `date -u`.

Co-Authored-By: Claude Fable 5 <[email protected]>
The sidebar (and Gallery > Map Filter...) opens the same navigable map
the import dialog uses — the boundary editor is now one shared piece —
and Apply makes the drawn boundary the gallery's filter: only photos
whose EXIF position falls inside it show, in every grouping, in search
results, and in the counts. Photos without a position hide, which is
the point of asking for a place.

The filter persists across launches, and a persistent filter someone
forgot is a gallery that looks mysteriously empty — so while it is on
the top strip wears a blue "Map filter: <place> x" banner (click to
edit, x to turn off) and the sidebar chip stays lit. Applying with
nothing drawn turns it off, and the dialog offers Turn Filter Off
outright.

Co-Authored-By: Claude Fable 5 <[email protected]>
The editor emptying now goes home: when the last tab closes on
desktop, the gallery reopens with everything as it was — search,
selection, folder filter, grouping and the map filter are session
state on the library, so leaving to edit a photo and closing it later
loses nothing. To match that session framing, the map filter stops
persisting across launches: a fresh start is unfiltered, and the loud
banner now only ever describes something chosen this session.

Co-Authored-By: Claude Fable 5 <[email protected]>
open_in_tab has always called fit_to_view, but a document opened from
the gallery — now the normal way in — arrives before the canvas has
ever laid out, so the fit ran against zero bounds, silently did
nothing, and a 12-megapixel photo landed at 100%, top-left. A fresh
document now owes itself a fit that the first real paint pays: the
immediate fit still runs (no flash when bounds are known), and the
paint-time one corrects both the never-painted case and bounds gone
stale while the gallery was up.

Co-Authored-By: Claude Fable 5 <[email protected]>
Arrows move the selection through the photos in display order —
left/right by one, up/down by a visual row, with the column count
worked out from the grid's recorded width since a wrap layout has no
rows to ask about — and Enter opens the selected photo (through the
CommitGesture binding, which takes the keystroke before any key
listener could). The grid scrolls to keep a keyboard-moved selection
on screen: the viewport and the selected cell report their painted
rectangles, and a per-render nudge converges the frame after the
selection moves. A first arrow with nothing selected lands on the
first photo; mouse clicks never auto-scroll.

Co-Authored-By: Claude Fable 5 <[email protected]>
Three repeat costs gone from the gallery search. The towers pre-load
in the background when the gallery opens — parsing and optimizing the
text model was the stall a first keystroke paid, and it memoizes.
Answered queries cache their text embedding and resolved place, so
every prefix retyped, every backspace, every repeated search is a
lookup instead of a model run (session cache, cleared past 512
entries). And the ranking task now receives the index as a shared
snapshot rebuilt only when the index actually gained entries, scoring
by borrowed path and cloning only the results that survive the cut —
a keystroke used to copy every path and vector in the library.

Co-Authored-By: Claude Fable 5 <[email protected]>
Selection goes plural: click, cmd-click toggle, shift-click and
shift+arrow ranges over the display order, the tray counting the
take. A drag (gpui's typed drag-and-drop, with a ghost naming its
cargo) carries the selection: dropped on a sidebar folder it moves
the files with each photo's sidecar and versions in tow — the
versioning invariant is that edits live beside their photo, and the
move test pins that a neighbour's versions stay behind.

Buckets are Picasa's tray with names: persisted baskets photos drag
into, viewed by clicking their row, acted on as a group from their
right-click menu — Save all as ZIP (a stored archive written by hand
on crc32fast, round-trip tested against the spec's offsets; photos
don't recompress) and Upscale all x2 (the built-in waifu2x, writing
<name>@2x.png beside each original, no download needed). Photos get
their own right-click menu too: Edit, Reveal in file manager, Add to
bucket, ZIP and upscale, acting on the whole selection when the
click lands in it.

Co-Authored-By: Claude Fable 5 <[email protected]>
An empty bucket used to show the watched-folders boilerplate ("No
photos found… scanned six levels deep"), which reads as a scanning
problem when the bucket is just new; it now says the bucket is empty
and how to fill it. Creating a bucket — from "+ New bucket" or the
photo menu's "Add to new bucket" — now asks for the name first, with
the old "Bucket N" as the dimmed fallback for an empty field. The
dialog needed the gallery's key handler to learn what the editor body
already knew: a modal owns the keyboard while it is up.

Co-Authored-By: Claude Fable 5 <[email protected]>
The bucket dialog grows into a rule editor: an optional search query
(the search box's engine and floor, place names and all) and/or an
area drawn on the shared map. Either one set makes the bucket smart —
marked ✦ in the sidebar — and it re-scores against the index whenever
the index generation moves, so it stays current as photos are
imported, edited and indexed. Both set means both must hold; a query
the engine can't read yet (models not installed, no place named)
matches nothing rather than everything. Contents are hand-adds in
drop order then matches best-first; the group actions act on the
union. Rules persist in library.json through an untagged enum so the
pre-rule tuple shape still reads; matches are derived and never
saved. Right-click gains Edit bucket…, which also un-smarts a bucket
by clearing its rule.

Co-Authored-By: Claude Fable 5 <[email protected]>
A focused empty field rendered its fallback in full text colour with
the caret welded on — "Bucket 1|" — indistinguishable from a field
someone had already filled in. The caret now belongs to the typed text
only, sitting alone at the start while the field is empty, with the
placeholder ghosted dim behind it like every real input.

Co-Authored-By: Claude Fable 5 <[email protected]>
2.5 GB resident, measured to its sources: every thumbnail ever
scrolled past was kept as BGRA forever (256 KB each — a gigabyte and
change on a big library), and opening the gallery eagerly loaded both
search towers into a never-releasing cache (measured on the real
models: nsfw +65 MB, image tower +114 MB, text tower +198 MB — 380 MB
held even in editor mode).

Three changes: decoded thumbnails now live under a ~1024-entry
(~256 MB) least-recently-shown budget, evicted back to the disk PNG
cache they reload from; the towers load when the search box is
focused, not on gallery open; and closing the gallery releases all
three models (new schist_neural::release) and parks the thumbnail set
at a quarter of its budget. Cheap in practice: scores and embeddings
live in disk caches and smart-bucket queries in the session query
cache, so a fully indexed library never reloads the models — only a
new photo or a never-seen query does, in the background.

The neural crate gains examples/rss.rs, the harness that produced the
numbers.

Co-Authored-By: Claude Fable 5 <[email protected]>
…ad at all

Astrid's scrolled-down-and-back-up grid went permanently blank. Two
layered causes, both verified headlessly (Xvfb + lavapipe, 126-photo
seeded library, wheel-scroll to the bottom and back with screenshots):

The eviction pass believed thumb() calls meant visibility, but the
grid builds an element for every photo every frame — all 5000 stamped
'just used', so eviction took effectively random thumbs (visible ones
included) while each frame re-queued thousands of decodes, forever.
Cells now report real visibility from a paint-time canvas probe of
their own rectangle, thumb() is a pure read, decodes happen only
within a viewport's height of the screen (which also stops the old
quiet decode-the-whole-library behaviour), and eviction refuses
anything stamped with the current frame.

Underneath that: grid_bounds was recorded by a canvas inside the
scrolled content, so the 'viewport' scrolled away with it — the probe
matched only cells near the content top (screenshot: empty grid at
the bottom of the scroll), and the arrow-key reveal logic compared
window-space cell bounds against it, over-scrolling whenever the grid
was not at the top. The recorder now subtracts the scroll offset,
putting grid_bounds in the window coordinates every consumer assumed.

Co-Authored-By: Claude Fable 5 <[email protected]>
IAmJSD and others added 26 commits September 1, 2026 16:04
Astrid: 'why does this happen every time? can we not store the index?'
and 'its a bit laggy'. Both were the same absence of restraint.

The index (embeddings, EXIF positions, capture times, places, filter
verdicts) lived only in per-photo cache files, so every launch pushed
all 5000 photos back through the loader to re-read them — with a
notify per 8-photo batch, each rebuilding a grid that constructs an
element per photo per frame. Now the whole index writes to one
snapshot file (hand-rolled LE binary, ~2 KB/photo, atomic tmp+rename)
whenever the loader catches up or the gallery closes, and restores in
one background read after the first scan — rows only count for photos
the scan still knows at the same mtime, so edited photos re-index.

The lag: the grid now virtualises by row — real cells only within a
viewport of the screen (and the lead selection's row, so keep-on-
screen still has bounds to steer by), consecutive hidden rows
collapse into one spacer div, and index-only loader batches repaint
at most four times a second instead of per batch.

Verified headlessly: relaunch logs 'index snapshot restored 126
photos', and the virtualised grid screenshots identically to the full
build at top and bottom of the scroll.

Co-Authored-By: Claude Fable 5 <[email protected]>
Two of Astrid's asks. The grid's right edge grows a scrollbar — gpui
scroll containers paint none — with the thumb sized and placed from
the scroll handle's own extents (exact, no content estimation),
draggable with the grip point kept, track clicks jumping straight
there, and the drag handled by the grid wrapper so the pointer can
wander off the twelve-pixel strip without dropping the thumb. And the
drag ghost stops being a name pill: picking up a photo now carries its
whole thumbnail square — selection border, dimmed a touch, a count
badge when the drag holds several — falling back to the pill only when
the thumbnail is not in memory.

Verified headlessly: XTest-dragging the thumb scrolls the grid with
the thumb tracking, and a held mid-drag screenshot shows the square
riding the pointer.

Co-Authored-By: Claude Fable 5 <[email protected]>
The hand-rolled inputs (the gallery search box, the bucket dialog's
name and query, layer and document names) drew their caret as a
static '|' welded to the end of the text: arrow keys did nothing
because there was no cursor position to move, and nothing blinked
because nothing repainted.

Now the textual fields carry a byte-position cursor (char-boundary
safe, tested against multibyte text): arrows move it, ⌘←/→ and
Home/End jump to the ends, typing and paste insert at it, backspace
and forward-delete eat the right sides of it, and ⌘A's selection
collapses to either end. The caret renders as a one-pixel bar that
keeps its slot while blinked off (no text shuffle), solid immediately
after every keystroke, on 530 ms beats driven by one self-retiring
timer task that runs only while a field has the keyboard. Numeric
fields keep their caret-less spinner behaviour. Web builds skip the
timer (Instant::now panics there) and show a solid caret.

Verified headlessly: typing d-o-g, Left, Left, x renders 'dxog', and
half-second-apart screenshots differ by exactly the 13 pixels of the
caret bar.

Co-Authored-By: Claude Fable 5 <[email protected]>
Astrid: the zip should hold the edited files, and 'if its lossy keep
it that else png'. It held whatever bytes were on disk, so an edited
photo archived as its unedited original.

Now each entry is the photo as the gallery shows it: the .schist
sidecar composited flat when there is an edit, the photo itself
otherwise. Format follows the source — a lossy photo stays in its own
format (unedited JPEGs pass through byte-for-byte rather than losing
a generation; edited ones re-encode at quality 92 over white, since
JPEG has no alpha), and everything else becomes a PNG, including
lossy formats with no encoder here (an edited HEIC lands as a PNG).
Entries are named for the photo, so an edited holiday.jpg is
holiday.jpg, not holiday.jpg.psd.

The writer became a streaming one: rendering full-size PNGs means a
bucket's worth no longer fits in memory, so entries are written as
they are produced, with the tray counting them and a tmp file taking
the real name only on a clean finish.

Co-Authored-By: Claude Fable 5 <[email protected]>
The gallery is where a fresh Schist lands, so its empty state is the
first thing anyone sees — and it only offered the two gallery ways in.
It now says hello and carries all four: Add Folder… and Import from
Camera… for a library, Open… and New File… for a single document,
with a line pointing at the shortcut that brings the gallery back.

Co-Authored-By: Claude Fable 5 <[email protected]>
Astrid: dragging a photo out of the window onto Finder/Explorer/a
Linux file browser should copy it there. gpui's drag-and-drop is
internal — a drag that left the window simply vanished — so this is
the platforms' own protocols, one small module each behind a shared
call.

The trigger is the interesting part: not "the pointer left our
rectangle" (a Finder window on top of the gallery is inside it) but
"the pointer is over a window that is not ours", which each platform
can answer — windowNumberAtPoint: on macOS, WindowFromPoint plus the
owning pid on Windows, and the window under the pointer versus
_NET_WM_PID on X11. At that moment the internal drag is stopped and
the platform's begins.

macOS: an NSDraggingSession of file URLs off the window's NSView, with
a runtime-built source that allows copy and only copy. Windows:
DoDragDrop with the shell's own data object (IShellItemArray bound to
BHID_DataObject) and a small IDropSource. X11: XDND from the source
side on its own thread and connection, reading the pointer with
QueryPointer rather than borrowing gpui's event loop.

Verified end to end on X11 against a scratch XDND target: a
single-photo drag delivers one file URI, a two-photo selection
delivers both. The Windows module is type-checked against the real API
by cross-compiling it for x86_64-pc-windows-gnu; the macOS module
cannot be compiled here at all (ring will not cross-build to darwin),
so its selectors were audited by hand — arity and spelling both, the
two things that crashed the camera module on hardware. Wayland is out
of reach: a client cannot start a drag without a compositor serial
gpui does not expose.

Co-Authored-By: Claude Fable 5 <[email protected]>
Before, an uninstalled search engine showed as a placeholder hint
inside a search box that could not search, and the two models had to
be found one at a time under Manage Models. The top strip's middle
slot now holds whichever of three things is true: a single 'Enable
photo search…' button, the download's progress bar, or the search box.

The button opens one dialog for both models — neither is any use
without the other — naming their sizes, their licences and the fact
that they run locally; agreeing downloads both. The bar sums the two
counters against the two sizes, so it reads as one download rather
than two, and counts models already installed as wholly fetched.
Nothing polls: the download's own repaint ticker drives the bar, and
the last repaint after install is what puts the search box there.

Verified headlessly end to end: the button renders, the dialog lists
both licences, and a real download walks the bar from 0 through 6.6,
61, 115, 184 MB of 215 before the box takes over.

Co-Authored-By: Claude Fable 5 <[email protected]>
Astrid asked whether drag-out supports Wayland. It does not (a client
cannot begin a drag without a data-device serial gpui never exposes),
and checking that turned up a bug: a Wayland desktop still exports
DISPLAY for XWayland, so the X11 hand-off would connect there, find
none of our windows (they are Wayland surfaces), decide every pixel
under the pointer was foreign, and cancel the in-app drag the moment
it started — breaking drags to folders and buckets on every native
Wayland session. The X11 module now asks gpui's own compositor guess
and does nothing unless the backend is actually X11.

Co-Authored-By: Claude Fable 5 <[email protected]>
Astrid: make it work on Wayland. It is the one platform where the
toolkit has to begin the drag itself — a compositor only accepts one
carrying the serial of the button press that started it, and only
gpui's client ever saw that — so the fork gains
Window::start_native_drag(mime, bytes): a wl_data_source offering one
mime type, copy only, started on the data device with the stored
mouse-press serial, its Send answered through the clipboard's
non-blocking pipe writer (fork commit 73c9da6, pinned here; it also
brings 6a7092a, the blade atlas fix that was ahead of the old pin).

Two things had to change on the schist side beyond the new arm. The
trigger: Wayland will not say whose window is under the pointer, so
there it is the pointer leaving our own rectangle, which the implicit
grab of a held button keeps reporting with coordinates past the edges
(sway sends motion(-100, 400) and no leave until release — checked at
the protocol level with WAYLAND_DEBUG). And the listener: element
mouse handlers are gated on their hitbox being hovered, which an
out-of-bounds pointer never is, so the hand-off now runs from a raw
window-level mouse listener registered at paint time — on every
platform, which is also what X11 should have had.

Verified against sway 1.9 headless with a virtual pointer and a
scratch wl_data_device target: a photo dragged from the gallery into
the target's surface arrives as file:///.../img103.png; the X11 path
re-verified on Xvfb after the listener change.

Co-Authored-By: Claude Fable 5 <[email protected]>
On Astrid's wording (ee0f82d). Centred ragged prose reads as a poster;
this is a page, so the column keeps its readable measure and its place
in the middle of the window while everything inside it — heading,
captions, button rows, the hairline now at column width — starts at
the same left edge.

Co-Authored-By: Claude Fable 5 <[email protected]>
Astrid: apply compression to the zip file. Each entry is now run
through flate2's raw deflate (already in the tree behind the PNG
codec) and written with whichever of deflated or stored is smaller —
a JPEG or PNG is already compressed and usually stays as it is, so
the archive never grows for having tried. The container stays the
hand-rolled hundred lines; method, compressed size and CRC (of the
uncompressed bytes, as the spec says) are the only fields that moved.

Verified beyond our own test: a produced archive passes unzip -t and
Python's zipfile.testzip, which reads the text entry as method 8 at
59 of 5600 bytes and the five-byte entry as stored. The test keeps
its archive when SCHIST_KEEP_ZIP=<path> is set, for exactly that.

Co-Authored-By: Claude Fable 5 <[email protected]>
Three of Astrid's asks in one round.

The AI panel is the gallery's too, on its own switch (View ▸ AI Panel,
cmd-shift-a, remembered per room — a chat column beside photos is
different furniture from one beside a canvas) while the harness, model
and conversation are shared. The prompt follows the room: a
conversation started in the gallery runs under a prompt describing it
and its tools; a send from the other room shuts the conversation down
and resumes it under that room's prompt, so the transcript and the
harness's thread carry over. The panel's own copy follows too. Found
on the way: the grid wrapper needed min_w(0) — a flex item's minimum
width is its content's, and a row of cells is fixed, so the 300 px
panel was being pushed off the right edge.

The in-app MCP server publishes the gallery beside the document tools:
gallery_state, gallery_list, gallery_search (the search box's ranking
answered in the reply, and shown in the box), gallery_thumbnail (the
cached PNG as image content), gallery_select, gallery_bucket_create /
gallery_bucket_add, gallery_group_by and gallery_open. Hand-declared —
the gallery is not a plugin — and dispatched ahead of the catalog by
their prefix; every one does what a click would, in front of the user.

A single selected photo no longer offers "Save as ZIP…" but "Save
image as…": format (every codec that exports — the raster codecs are
WASM plugins, so the list comes from the registry), quality where the
format takes one, and a 10–100% scale slider labelled in pixels. It
saves the edit when there is one, flattened and Lanczos-resized,
through a one-layer document like the clipboard's export; the original
is never touched. Several photos keep "Save N as ZIP…".

Verified: the panel renders beside the reflowed grid and the dialog
labels 100% as 96 × 96 for a 96-pixel test photo (headless); the
renderer round-trips an 8×4 magenta edit at 50% into a 4×2 PSD; the
tool definitions are checked for unique namespaced names and declared
required arguments; the thumbnail base64 matches the standard vectors.

Co-Authored-By: Claude Fable 5 <[email protected]>
Astrid: tool calls to handle filtering by NSFW. Two tools:
gallery_content_filter reads the filter (switch, whether the Content
model is installed, how many photos are flagged, clean, or not yet
scored, how many the grid is hiding right now) or sets it — switching
it on without the model is refused with where to get it — and
gallery_flagged lists photos by verdict, paged, with the folder and
map filters applied and the content switch deliberately not. Rows
from every listing tool now carry the verdict too, null while
unscored.

One fix under it: the indexer only queued photos missing a position
or an embedding, so a scorer installed after the position pass had
run never saw the library. It now queues unscored photos as well
whenever the model is present, so "unscored" shrinks to nothing on
its own.

Co-Authored-By: Claude Fable 5 <[email protected]>
Astrid: shouldn't we update the mcp binary too. It can, because
everything the gallery persists is a file: library.json, the index
snapshot, the caches beside the thumbnails. Rather than teach the
stdio server those formats a second time, the gallery's on-disk model
moves out of the app into `schist-gallery` — paths, the folder scan,
library.json's shapes, the index snapshot, the score/embedding/meta
caches, the gazetteer and geo maths, the search ranking — with one
owner for each format, and a headless `Gallery` that reads what the
app wrote. The app's library.rs and library_geo.rs now import from it
(GeoBounds moves with its inherent impls and is re-exported where the
modal enum needs it; crash::state_dir delegates), and their tests
travel with the code.

schist-mcp publishes the same gallery_* family over the headless one,
dispatched by prefix ahead of the registry's catalog: gallery_state,
gallery_list, gallery_search (the snapshot's embeddings, ranked as
the box ranks), gallery_thumbnail, gallery_flagged, gallery_bucket_
create / _add (written to library.json, which the app reads at
launch), and gallery_open, which opens the photo — its edit sidecar
when it has one — as a new editing session. It cannot index and
cannot see a window's selection or grouping; the reply says so.

Verified by driving target/debug/schist-mcp over stdio: tools/list
carries the eight, state counts the 126 test photos, list and flagged
page them, a cached thumbnail comes back as image content, "taken in
new york" resolves the place, a bucket created and appended through
the server lands in library.json, and gallery_open yields session s1.
Tests: 88 app + 7 gallery + 17 mcp; clippy, fmt and the wasm build
clean (the headless module is native-only, as the text tower is).

Co-Authored-By: Claude Fable 5 <[email protected]>
Astrid: dragging in a directory should ask whether to open the images
or add the folder to the gallery. Dropped paths now split into folders
and files; the files open as they always did, and the folders raise a
dialog that says how many images a scan found in them (sub-folders
included) and offers Add to Gallery — the primary button, watching the
folders in place through the same path the picker uses — or opening
them as tabs, capped at a hundred so a dropped camera roll cannot open
five thousand tabs; the status line says when the cap bit.

Verified headlessly: an XDND drop of a directory of 120 photos onto
the welcome screen raises "“many” holds 120 images… Open First 100 in
Tabs / Add to Gallery", and Add to Gallery records the folder in
library.json and shows the grid.

Co-Authored-By: Claude Fable 5 <[email protected]>
Astrid: if the image has EXIF data, make the side panel tabbed with
EXIF first and selected by default, with camera data and the location
on a map with a blip. The panel's top slot now grows a tab row when
the open file carries EXIF — Info first and the default, Color beside
it — and stays the plain colour panel otherwise. Info shows the
camera (make and model, said once), the lens, the exposure on one line
with the 35 mm equivalent, bias, flash / white balance / metering,
when it was taken, the size in megapixels, the software, and where:
the nearest gazetteer city with coordinates and altitude, and the
gallery's map opened on the spot at street scale with a red-and-white
blip. A gallery edit reads its original photo's EXIF; the sidecar has
none.

Underneath: the EXIF summary lives in schist-gallery (the app no
longer links the EXIF crate directly), the map machinery takes a slot
— the gallery's or the info panel's, each with its own state and
markers — and the tab choice is session state that resets with the
document.

Verified headlessly on a PIL-made JPEG tagged as an iPhone 15 Pro in
Times Square: every row renders, the map shows West 47th Street, and
the blip sits on it.

Co-Authored-By: Claude Fable 5 <[email protected]>
Astrid's screenshot: a black line across the Info map and Layers
painted over History. Both were one thing — the side column was a
fixed-height flex column, so once the Info tab made it taller than the
window the growing panels below were shrunk into each other, and one
of their top borders landed across the map.

The column now scrolls (with a floor under Layers and History so they
never collapse inside it; short content still fills the column as
before), and the wheel over a map stays zoom rather than scrolling the
panel it sits in, as on every web map.

Verified headlessly on the EXIF test photo: the panels lay out without
overlap, and a wheel over the Layers area scrolls the column to reveal
the layer toolbar and History intact.

Co-Authored-By: Claude Fable 5 <[email protected]>
The EXIF rows are a bounded scrolling region with a thumb beside
them, and the map sits fixed beneath at 16:9 across the panel's
width, so a chatty camera never pushes the map out of reach.

Co-Authored-By: Claude Fable 5 <[email protected]>
Three rows before it scrolls, not seven.

Co-Authored-By: Claude Fable 5 <[email protected]>
The web build has no file system — its opened files live in memory
under invented paths — so the EXIF parser now also works from bytes,
and the web build feeds it those. The map stays native-only.

Co-Authored-By: Claude Fable 5 <[email protected]>
gpui samples sprites bilinearly out of an unpadded atlas, so a tile
magnified on a Retina display blended its edge pixels with whatever
sat beside it in the atlas — a dark line along every tile boundary,
which for a London photo at street scale ran right under the blip.
Tiles now carry a one-pixel gutter of their own edge colour, drawn a
pixel larger and clipped to the true tile, and the tile grid's offset
snaps to whole device pixels. Pixel-for-pixel identical at 1×.

Co-Authored-By: Claude Fable 5 <[email protected]>
With the filter on, flagged photos never leave in an archive — from a
selection, a bucket's Save all, or an agent — the menu rows count only
what would go, and the status line says how many stayed behind.

Co-Authored-By: Claude Fable 5 <[email protected]>
Ctrl-wheel on Linux and Windows. Taken in the capture phase so it
wins over the grid's own scrolling; up is bigger, as on the map, and
the tray slider follows.

Co-Authored-By: Claude Fable 5 <[email protected]>
@IAmJSD
IAmJSD merged commit 38610ba into main Sep 2, 2026
4 checks passed
@IAmJSD
IAmJSD deleted the t3code/picasa-lightroom-gallery-mode branch September 2, 2026 16:09
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