breadpad: add --screenshot CLI mode for automated capture

Same reasoning as breadbar/breadbox/breadclip/breadsearch, but plumbed
through breadpad's own hand-rolled arg parser (mod args) instead of clap
— breadpad doesn't use clap at all, and adding a second, separate clap
parser alongside the existing one would reject every one of breadpad's
real flags (--type, --no-classify, --status, fire, calendar, ...) the
moment it saw one clap didn't recognize. --screenshot/--output/--width/
--height are just three more fields on the same Args struct.

Only the "popup" view (the compose window) is wired up — the reminder
window needs a real stored Note to render, not worth fabricating one
just for a screenshot pass.

Also fixes the same single-instance footgun as the other apps: without
NON_UNIQUE, a screenshot run would just toggle-close the operator's real
already-open popup instead of getting its own window.
This commit is contained in:
Breadway 2026-07-29 11:43:55 +08:00
parent 1289c05c47
commit 879ec1e7f4
4 changed files with 166 additions and 9 deletions

21
Cargo.lock generated
View file

@ -302,6 +302,16 @@ dependencies = [
"piper",
]
[[package]]
name = "bread-screenshots"
version = "0.3.1"
source = "git+https://git.breadway.dev/Breadway/bread-ecosystem?branch=dev#1a3475bd2358202f60e29c9bd27d06b1428b1a27"
dependencies = [
"anyhow",
"bread-utils",
"tracing",
]
[[package]]
name = "bread-theme"
version = "0.2.3"
@ -313,6 +323,16 @@ dependencies = [
"serde_json",
]
[[package]]
name = "bread-utils"
version = "0.3.1"
source = "git+https://git.breadway.dev/Breadway/bread-ecosystem?branch=dev#1a3475bd2358202f60e29c9bd27d06b1428b1a27"
dependencies = [
"dirs 5.0.1",
"serde",
"serde_json",
]
[[package]]
name = "breadman"
version = "0.3.4"
@ -335,6 +355,7 @@ name = "breadpad"
version = "0.3.4"
dependencies = [
"anyhow",
"bread-screenshots",
"breadpad-shared",
"chrono",
"dirs 5.0.1",