Expand description
Data-control clipboard client bridging a nested app compositor’s selection. Data-control CLIENT: the native clipboard bridge to a NESTED app compositor (labwc/kwin running under pixelflux).
Apps in a nested session use the inner compositor’s selection, which
pixelflux’s own clipboard machinery never sees. selkies bridges it over the
ScreenCapture ABI backed by this module instead of forking wl-copy/wl-paste
per operation: one-shot [list_types]/[read], a write that returns with
the selection taken (a detached thread then serves paste requests until
another client takes the selection), and [watch] (a thread reporting
selection changes to a SelectionWatch). The compositor is spoken to through
ext_data_control_manager_v1 (KWin since Plasma 6.3, wlroots since 0.19) or
zwlr_data_control_manager_v1 (earlier wlroots and KWin), preferring the
standardized ext form when both are advertised. Every compositor round-trip
is deadline-bounded via wlclient::bounded_roundtrip.
Structs§
- DcState 🔒
- OwnRead 🔒
- Watch
Handle 🔒
Enums§
- DcDevice 🔒
- DcManager 🔒
- The two data-control protocol families behind one shape: both define the same manager/device/source/offer object graph with identical semantics, so each wrapper dispatches the one request set to whichever family the compositor advertised. Objects never mix families: everything descends from the single manager chosen at bind time.
- DcOffer 🔒
- DcSource 🔒
Constants§
- STOP_
POLL 🔒 - How often a background thread wakes from its socket poll to check its stop flag, bounding unwatch/shutdown latency.
Statics§
- OWN_
READS 🔒 - Reads by this process in flight (
read): a send answering one is not a paster’s, and goes uncounted (a paste served beside one only waits longer). - SERVED 🔒
- The number of the last [
write] and the mimes its selection has served in full, in order: a caller restoring the clipboard after a paste waits on it (served) for the paster’s fetch instead of guessing how long it takes. - SERVED_
GREW 🔒 - WATCHERS 🔒
Functions§
- clear 🔒
- Drop the selection (the compositor also cancels whatever source held it).
- list_
types 🔒 - Mimes offered by the current selection (empty when nothing is copied).
- open_
device 🔒 - Connect to
socket_pathand return (connection, queue, state, device) with the current selection already delivered. - read 🔒
- The current selection’s payload for
mime, or None when there is no selection or it does not offer that mime. - serve_
selection 🔒 - served 🔒
- The mimes the last [
write]’s selection has served, once it has served more thanafterof them ortimeouthas passed. - unwatch 🔒
- Stop the watch on
socket_path(no-op when none is running). - unwatch_
all 🔒 - Stop every clipboard watch (process teardown sweep; watches are not tied to captures, so the global stop helper must reach them explicitly).
- watch 🔒
- Report every selection change on
socket_path(including the one current at start) tocallback(mimes: list[str])from a background thread, a cleared selection as no mimes. A second watch on the same socket replaces the first. - watch_
loop 🔒 - write 🔒
- Take the selection, serving
entries(mime, bytes) to every paster from a detached thread until another client takes the selection (or the compositor goes away). The selection is compositor-acknowledged when this returns, so a caller may immediately trigger a paste against it. Replacing a previous write is implicit: the compositor cancels the old source when the new one takes the selection.