breadclipd: watch-driven capture, flock singleton, ignore rules, pin verb
- Capture now keys off wl-paste's `CLIPBOARD_STATE`: `sensitive`
(password manager via `wl-copy --sensitive`, covers the old
x-kde-passwordManagerHint case) and `nil`/`clear` persist nothing;
`data` reads the content off stdin in the same event, so the
sensitive check and the read can't straddle a clipboard change.
A manual `--capture-once` with no CLIPBOARD_STATE falls back to
querying wl-paste directly, now wrapped in `timeout -k 2 5` so a
stalled offer can't block a capture process forever.
- Single-instance guard moves to `bread_utils::singleton` (flock) —
kernel-atomic, auto-released on death, no stale pid file.
- `ignore_rules::is_sensitive`: conservative best-effort heuristics
that skip copies which look like secrets even when unflagged —
PEM/OpenSSH private key blocks, `password:`-style lines, labelled
one-time codes, Luhn-valid card numbers, well-known token prefixes.
A convenience, not a security boundary.
- `bread.command.clip.pin` verb (payload `{id, pin?}`, pin defaults
true) → `set_pinned`, emits `bread.clip.pinned` / `.pin.failed`.
- Two independent `wl-paste --watch` loops (regular clipboard always
on; primary selection when `capture.primary`), each restarting with
2s→30s capped backoff and state-change-only journal logging.
- Image type is sniffed from magic bytes (PNG/JPEG) on the stdin path
and requested by actual offered type on the fallback path — a JPEG
is stored as `.jpg` / `image/jpeg`, not relabelled PNG.
- content_kind: a single line of prose that merely contains a keyword
("class is a concept") no longer classifies as code — it must look
like a statement.
This commit is contained in:
parent
967fd9f1b7
commit
83630033cd
4 changed files with 555 additions and 111 deletions
|
|
@ -11,6 +11,11 @@ ExecStart=%h/.cargo/bin/breadclipd
|
|||
Restart=on-failure
|
||||
RestartSec=2
|
||||
|
||||
# wl-paste/wl-copy live on the user's PATH (e.g. ~/.local/bin or
|
||||
# ~/.cargo/bin via bakery/cargo install), which systemd user services don't
|
||||
# inherit by default — without this, breadclipd starts but captures nothing.
|
||||
Environment=PATH=%h/.local/bin:%h/.cargo/bin:/usr/local/bin:/usr/bin:/bin
|
||||
|
||||
# Forward stdout/stderr to the journal so `journalctl --user -u breadclipd` works
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue