Skip to main content

copy_plain_text_to_clipboard

Function copy_plain_text_to_clipboard 

Source
pub fn copy_plain_text_to_clipboard(text: &str) -> Result<(), String>
Expand description

What: Copy plain text to the system clipboard without extra suffixes.

Inputs:

  • text: Exact bytes to place on the clipboard.

Output:

  • Ok(()) when wl-copy or xclip accepted stdin.

ยงErrors

  • Returns Err with install guidance when neither clipboard tool could be spawned.

Details:

  • Prefers wl-copy when WAYLAND_DISPLAY is set, otherwise tries xclip.
  • Does not invoke a shell; uses Command argument lists only.