Skip to content

Commit 3b86c09

Browse files
authored
feat: persist an op log and capture the monitor in-process
The editor now treats the unmutated source plus a JSON op stack as the working document, so undo survives crash and --file reopen. Monitor pixels come from ext-image-copy-capture instead of grim; a window pick is a crop of that frame. Also records Cut ops, keeps the leading crop under the 100-op cap, restores notify quoting, and keeps selected handles out from under the help card after the taller cut-tool legend.
1 parent 4a93469 commit 3b86c09

11 files changed

Lines changed: 1381 additions & 405 deletions

AGENTS.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ markers, text, OCR). Finished captures go to clipboard,
2929
|---|---|
3030
| `src/main.cpp` | CLI parsing, single-instance lock, mode dispatch (capture / edit file / pin) |
3131
| `src/instance-lock.cpp/.hpp` | Single-instance handover: cancel a running overlay, or stop it and take over for `--file` |
32-
| `src/capture.cpp/.hpp` | Capture selection overlay, rendering, output, and private runtime snapshots |
33-
| `src/editor.cpp/.hpp` | Annotation editor: tools, vector layers, undo/redo, rendering, export |
32+
| `src/capture.cpp/.hpp` | Capture, rendering, output, and source+JSON operation-log persistence |
33+
| `src/editor.cpp/.hpp` | Annotation editor: tools, vector layers, operation-log undo/redo, export |
3434
| `src/pin.cpp/.hpp` | Pinned-capture layer-shell surfaces (bottom-right, all workspaces) |
35-
| `src/surface-capture.cpp` | Clean window capture via `ext-image-copy-capture` Wayland protocol |
35+
| `src/surface-capture.cpp` | In-process output/window capture via `ext-image-copy-capture` |
3636
| `src/icons.cpp/.hpp` | Vector icon renderer for toolbar and pin controls |
3737
| `src/cli-path.cpp/.hpp` | Command-line image target resolution |
3838
| `src/eyedropper.cpp/.hpp` | Display-to-source color sampling |
@@ -59,7 +59,7 @@ Always run `make check` after behavioral changes. CI
5959
push and PR.
6060

6161
Dependencies (Arch): `base-devel cmake ninja pkgconf qt6-base layer-shell-qt
62-
wayland wayland-protocols grim wl-clipboard tesseract tesseract-data-eng`.
62+
wayland wayland-protocols wl-clipboard tesseract tesseract-data-eng`.
6363

6464
## Release process
6565

README.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ resizable vector layers and preserves the monitor's native pixels on scaled disp
1313
- A pointer-side readout that turns any drag into a ruler: the pointer position
1414
while the crosshair is idle, then the frame size in native export pixels while a
1515
region, a hovered window, or a crop handle is being sized.
16-
- Clean window-surface capture through Wayland image-copy protocols. A failed native
17-
capture stays in the window picker; Omasnap never substitutes a crop of the desktop.
16+
- Window capture is a crop of the focused-monitor frame. Overlapping windows stay
17+
visible; there is no second clean-window recapture.
1818
- Select/move/resize layers, mouse-wheel scaling, and eight external recropping handles.
1919
- Arrows, straight lines, smoothed freehand strokes, translucent highlighter strokes,
2020
hollow or filled rectangles (optionally rounded) and ellipses, numbered markers,
@@ -27,10 +27,10 @@ resizable vector layers and preserves the monitor's native pixels on scaled disp
2727
live preview and dashed seam marker while dragging; annotations shift to follow.
2828
- Pin a finished capture as a bottom-right always-on-top layer surface, launched
2929
from the same `omasnap` executable and visible on every workspace.
30-
- Crash-resistant working snapshots under `/run/user/<UID>/omasnap/` (falling back to
31-
a private `/tmp/omasnap-<UID>/`), written immediately after selection and overwritten
32-
after every completed edit. Saving moves that file into `~/Pictures/Screenshots`;
33-
clipboard output streams the same PNG.
30+
- Crash-resistant working documents under `/run/user/<UID>/omasnap/` (falling back to
31+
a private `/tmp/omasnap-<UID>/`): the original source image plus a sidecar JSON
32+
operation log. Undo still works after a crash or `--file` reopen. Saving and
33+
copying write a normal flattened PNG to the clipboard or `~/Pictures/Screenshots`.
3434
- Verified PNG clipboard output through `wl-copy`/`wl-paste`, plus timestamped files
3535
under `~/Pictures/Screenshots` by default.
3636
- Open an image already on the clipboard directly in the annotation editor.
@@ -39,17 +39,17 @@ resizable vector layers and preserves the monitor's native pixels on scaled disp
3939
## Platform scope
4040

4141
The supported target is **Wayland + Hyprland**, with Omarchy as the primary integration.
42-
The renderer, layer surface, clipboard, and clean-window capture use Wayland protocols;
43-
monitor/window discovery currently calls `hyprctl`. `grim` captures the monitor before
44-
the layer maps. Selection displays that captured frame, while the annotation editor uses
42+
The renderer, layer surface, clipboard, and monitor capture use Wayland protocols;
43+
monitor/window discovery currently calls `hyprctl`. The focused output is captured
44+
in-process through `ext-image-copy-capture` before the layer maps. Selection displays
45+
that captured frame, while the annotation editor uses
4546
a translucent layer scrim over the live desktop and draws only the selected capture.
4647
Another Wayland compositor could support the application after supplying equivalent
4748
monitor and window discovery; generic Wayland support is not claimed by 1.0.
4849

4950
Runtime commands used by the application:
5051

5152
- `hyprctl`
52-
- `grim`
5353
- `wl-copy` and `wl-paste`
5454
- `tesseract`
5555
- `omarchy-notification-send` when available; saved captures include a thumbnail and
@@ -113,7 +113,7 @@ Install the complete build/runtime dependency set:
113113
```bash
114114
sudo pacman -S --needed \
115115
base-devel cmake ninja pkgconf qt6-base layer-shell-qt \
116-
wayland wayland-protocols hyprland grim wl-clipboard \
116+
wayland wayland-protocols hyprland wl-clipboard \
117117
tesseract tesseract-data-eng tesseract-data-tha
118118
```
119119

@@ -332,9 +332,10 @@ QT_QPA_PLATFORM=offscreen \
332332
```
333333

334334
The smoke executable exercises region/window/fullscreen startup modes, capture selection,
335-
temporary snapshot updates, annotation tools, undo/redo, vector movement and scaling,
336-
text editing, OCR, native-DPI output, endpoint-only line selection, external crop
337-
handles, and the native-pixel measurement readout on a scaled monitor.
335+
working-document persistence (source plus op-log JSON), annotation tools, undo/redo
336+
replay, vector movement and scaling, text editing, OCR, native-DPI output,
337+
endpoint-only line selection, external crop handles, and the native-pixel
338+
measurement readout on a scaled monitor.
338339

339340
`.github/workflows/build-linux.yml` performs the same release build and interaction smoke
340341
in an Arch Linux container, stages the CMake installation, and uploads a versioned Linux

install-omarchy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ fi
1212

1313
omarchy-pkg-add \
1414
base-devel cmake ninja pkgconf qt6-base layer-shell-qt \
15-
wayland wayland-protocols grim wl-clipboard \
15+
wayland wayland-protocols wl-clipboard \
1616
tesseract tesseract-data-eng tesseract-data-tha
1717

1818
cmake -S "$repo_dir" -B "$build_dir" -G Ninja \

0 commit comments

Comments
 (0)