lamco-data-control 1.0.1

Wayland data-control clipboard client (ext-data-control-v1 and wlr-data-control) with on-demand pastes
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//! Print the clipboard as text.

use lamco_data_control::DataControl;

fn main() -> lamco_data_control::Result<()> {
    let clipboard = DataControl::connect()?;
    println!("protocol: {}", clipboard.protocol());
    println!("offered: {:?}", clipboard.selection_mime_types());
    match clipboard.read("text/plain;charset=utf-8")? {
        Some(bytes) => println!("{}", String::from_utf8_lossy(&bytes)),
        None => println!("no text on the clipboard"),
    }
    Ok(())
}