Skip to main content

Module dcclient

Module dcclient 

Source
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 🔒
WatchHandle 🔒

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_path and 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 than after of them or timeout has 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) to callback(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.