Skip to content

feat(reader): open a picture in a message in the lightbox on click - #713

Closed
adriadam10 wants to merge 1 commit into
hyprlab:mainfrom
adriadam10:feat/reader-image-lightbox
Closed

adriadam10 wants to merge 1 commit into
hyprlab:mainfrom
adriadam10:feat/reader-image-lightbox

Conversation

@adriadam10

Copy link
Copy Markdown
Contributor

What

A click on a picture in a message body now opens it in the existing lightbox (the one attachments use), to zoom in on, save or print — the way most mail and chat clients treat inline images.

  • Remote pictures are shown from the copy the reader already loaded (remote_content cache), so the click fetches nothing new; inline (cid: / data:) pictures come from the message itself.
  • A picture inside a link still follows the link.
  • Pictures smaller than 48 px in either dimension (icons, spacers, signature logos) are left alone.
  • Modifier clicks, drags and non-primary buttons are ignored.
  • Works in the main window and in a message's own window.

How

The message frames are sandboxed without allow-scripts, so listeners attached to their documents never fire (checked: the handler never ran). The click is detected GTK-side instead: mouse-target-changed gives the HitTestResult under the pointer (context_is_image(), not a link, image_uri()), and a capture-phase GestureClick emits MessageViewInput::ShowImage(uri) on a plain single click. links::show_image gets the bytes, names the file by its content type and emits MessageViewOutput::ShowImage, which the app routes to ShowLightbox / MessageWindowInput::Lightbox.

Testing

  • cargo test: all pass.
  • HYLKI_SHOWCASE_CLICK_IMAGE=1 (showcase hook) drives the same path with the first picture in the demo mail: the lightbox opens with it.
  • The real mouse gesture (hit test plus GestureClick) is not covered by an automated test; I am trying it by hand in a daily-use build.

Written with Claude Code; the commit carries a Co-Authored-By: Claude trailer required by my organization's settings, even though tools/git-hooks/commit-msg asks for none. Happy to drop it when squashing.

A click on a picture in a message body shows it in the lightbox, as an
attached one shows. The frames run no script, so the click is found on the
GTK side: the hit test under the pointer names the picture, and a plain
single click on one that is not a link opens it. A remote picture comes
from the copy the reader already loaded, so nothing is fetched; pictures
under 48 pixels (icons, spacers) are left alone.

Co-Authored-By: Claude <noreply@anthropic.com>
hyprlab added a commit that referenced this pull request Nov 25, 2026
A plain click on a picture in a message body shows it in the lightbox. WebKit claims left clicks, so a GestureClick on the web view never sees the release; the click is read in the reader's legacy pointer controller, from the picture WebKit's hit test last named under the pointer.

Co-Authored-By: Adrià <57327458+adriadam10@users.noreply.github.com>
@hyprlab

hyprlab commented Nov 25, 2026

Copy link
Copy Markdown
Owner

Agentic reply:

Your picture lightbox is in the 1.50.0-beta.4 release, landed as b6baf46 with you as co-author. links::show_image, the ShowImage messages and their routing to the lightbox in the main window and a message's own window are as you wrote them. One change: WebKit claims left clicks on the web view, so the capture GestureClick never saw the release and a click only selected the card. The click is now read in the reader's existing pointer controller, from the picture WebKit's hit test last named under the pointer. Please test it there and report anything that doesn't look right. It reaches the stable channel with the next stable release.

If you've installed Hylki beta as a Flatpak, running flatpak update will pick it up automatically. If not, download and install it first:

flatpak install --user --from https://hylki.hyprlab.co/flatpak/co.hyprlab.Hylki.Beta.flatpakref

AppImage, Debian and RPM betas: See Beta channel for update details.

@hyprlab hyprlab closed this Nov 25, 2026
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.

2 participants