alacritty/copypasta

Element not found on Win11

hb0nes opened this issue · 1 comments

hb0nes commented
use copypasta::{ClipboardContext, ClipboardProvider};

fn main() {
    let mut ctx = ClipboardContext::new().unwrap();
    let content = ctx.get_contents().unwrap();
    println!("{content}");
}

Results in:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 1168, kind: Uncategorized, message: "Element not found." }', src\main.rs:5:38
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: process didn't exit successfully: `target\release\rs-type-clipboard.exe` (exit code: 101)

edit; Cargo.toml:

[package]
name = "rs-type-clipboard"
version = "0.1.0"
edition = "2021"

[dependencies]
copypasta = "0.8.2"

edit; It works when first doing set_content but I'm not interested in using only what I set in the code itself, I'm interested in the Windows clipboard from outside of the application I'm writing.

hb0nes commented

Fixed itself, suddenly started working.