import "conglinyizhi/screen-kacha/moonpipewire" @pipewire
fn main {
// 构造只记配置,不做 I/O
let pw = @pipewire.PipeWire::new(app_name="my-app")
// 连流,立刻返回:底层在 C 线程里跑 main loop
if pw.connect(42) != 0 {
abort()
}
let (w, h) = pw.size()
let buf = Bytes::makei(w * h * 4, fn(_) { 0 })
if pw.copy_frame(buf) > 0 {
// buf 里是 BGRx,每行 w*4 字节
}
pw.disconnect()
}let n = pw.save_frame("/tmp/frame.bgra")options(
link: { "native": { "cc-link-flags": "-lpipewire-0.3" } },
)pub struct PipeWire {
app_name : String
started : Bool
}Install
Download zipHTTP screen snapshot service for the local desktop (KDE Wayland)