lamco-data-control 1.0.0

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
15
16
17
18
//! Set the clipboard to the first argument and hold it until interrupted.

use lamco_data_control::{Content, DataControl};

fn main() -> lamco_data_control::Result<()> {
    let text = std::env::args()
        .nth(1)
        .unwrap_or_else(|| "hello".to_owned());
    let clipboard = DataControl::connect()?;
    clipboard.set_selection(
        Content::new()
            .data("text/plain;charset=utf-8", text.clone())
            .data("text/plain", text),
    )?;
    println!("clipboard set; press Ctrl-C to release it");
    std::thread::park();
    Ok(())
}