Files
chandra/docs/screenshot-editor.md
T
nandiandClaude Opus 5.5 7ce5b79af2
CI / test (push) Successful in 1m12s
Deploy to the handset / build-and-deploy (push) Failing after 1m31s
Drop the screenshot tests and the moon-disc module; just test runs every lib package
- Tests that only wrote PNGs to look at are gone: desktop, overview (and its overview_shot
  helper), editor, emoji picker, launcher/Icon Desktop and dock screenshots. They were among
  the slowest in the suite; the behaviour they touched has its own tests.
- moon-disc never had source in the tree, so every fresh panel said "Module 'moon-disc' not
  found". It is out of the default panel, and a saved panel drops it (migrate_panel). The
  settings module's sample rows and labels no longer mention it.
- The settings module lists Show Desktop under "Apps and windows", with a description.
- just test ran lib/taskbar, lib/layoutpick and lib/modmgr, which no longer exist, so the wasm
  lib tests failed to start; it now runs every package in lib/ (83 tests).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 13:05:40 -08:00

4.2 KiB

Screenshot editor

Every screenshot (Super+Shift+S, Print, Super+Print, Super+Ctrl+Print, or the Screenshot panel module) opens in the editor before it is saved, after KDE Spectacle's annotation mode. The picture fills the screen. The tools are above it, and the colours, sizes, Undo/Redo and the Discard / Copy / Save buttons are below it.

Screenshot editor

Tools

Tool Key What it does
Arrow A Drag from the tail to the tip
Line L Drag
Rectangle R Drag an outline
Ellipse E Drag an outline (fits the dragged box)
Pen P Draw freehand
Highlighter H Freehand, wide and translucent, even where the stroke crosses itself
Text T Click, type, then Enter or a click elsewhere (Backspace deletes, Esc drops it)
Number N Click to drop a numbered disc: 1, 2, 3, ...
Blur B Drag a box: its content is destroyed (see below)
Pixelate X Drag a box: blocks of one colour (block size follows the size setting)
Redact D Drag a box: an opaque box in the chosen colour
Crop C Drag the part to keep; the last crop counts and can be undone

Colours: 1-8 (red, orange, yellow, green, blue, purple, black, white). Size: [ and ] (thin, medium, thick); text, markers and pixel blocks grow with it. The editor remembers the tool, colour and size for the next screenshot.

Keys

Keys Action
Enter, Ctrl+S, Save button Save to ~/Pictures/Screenshots/ (XDG_PICTURES_DIR) and copy to the clipboard
Ctrl+C, Copy button Copy to the clipboard only, no file
Esc, Discard button Discard (Esc first drops a shape or text being made)
Ctrl+Z / Ctrl+Shift+Z, Ctrl+Y Undo / redo
Right-click Drop the shape being drawn

Hiding things for real

Annotations are drawn into the picture's pixels at full size the moment you finish them, and the editor shows that picture, so what you see is what is saved.

  • Redact paints every pixel of the box in the chosen colour with full opacity.
  • Pixelate replaces each block with its average colour.
  • Blur first replaces each 6 x 6 block with its average (the detail is gone at that point), then runs three box-blur passes each way with a radius of a sixth of the box's smaller side (6 to 24 px). It reads and writes only the pixels inside the box.

compositor/host/annotate_test.mbt checks this pixel by pixel. Pixels outside the box don't change. Two different patterns with the same average blur to the same result. A blurred "word" ends up flat, with neighbouring columns at most 4 levels apart (the word was 220 levels darker than its background). Redact stays opaque over a translucent picture.

How it is built

The editor is drawn by the compositor (compositor/host/shot_editor.mbt), like the selection overlay, rather than being a separate component window:

  • The picture is already there. When the host holds the frozen screen (the wasm compositor), the selected part is handed over once with snapshot-pixels.
  • The keyboard has a single owner: the editor takes it, and the window that had it gets it back when the editor closes.
  • On the CPU: each finished annotation is drawn once into a full-size copy of the picture (annotate.mbt). That copy is scaled to the size it is shown at and handed to the renderer as a few images of at most 2 MB each (raster.image-pixels), drawn 1:1 one under the other. A single 8 MB call runs out wasmtime's hostcall fuel and kills the wasm host. A frame then draws only the annotation in progress as plain draw ops, and nothing is redrawn while you aren't drawing. Undo redraws the picture from the original.
  • The windows behind are frozen, as under the selection overlay. Their commits are shown when the editor closes, and their frame callbacks are held back until then (WaylandServer::set_hold_frames), so apps stop drawing frames nobody sees. Measured on the wasm host at 1920x1080 with an app redrawing full screen behind the editor: 0% CPU, against 52% for the same app on the desktop.
  • A picture saved unchanged is encoded by the host (snapshot-png), as before. An edited one is encoded with @renderer.encode_png_compressed.