From 9e3e65e721fe506ef0462b72d3d7c6373bb61fa7 Mon Sep 17 00:00:00 2001 From: Jason Rodney Hansen Date: Sat, 11 Jan 2025 17:26:16 -0700 Subject: [PATCH] Add more plain text mime types when copying files This allows the full path of the copied file to be pasted as text into more applications. --- src/clipboard.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/clipboard.rs b/src/clipboard.rs index 3290948..9fda588 100644 --- a/src/clipboard.rs +++ b/src/clipboard.rs @@ -28,6 +28,8 @@ impl ClipboardCopy { pub fn new>(kind: ClipboardKind, paths: &[P]) -> Self { let available = vec![ "text/plain".to_string(), + "text/plain;charset=utf-8".to_string(), + "UTF8_STRING".to_string(), "text/uri-list".to_string(), "x-special/gnome-copied-files".to_string(), ]; @@ -94,7 +96,9 @@ impl AsMimeTypes for ClipboardCopy { fn as_bytes(&self, mime_type: &str) -> Option> { match mime_type { - "text/plain" => Some(self.text_plain.clone()), + "text/plain" | "text/plain;charset=utf-8" | "UTF8_STRING" => { + Some(self.text_plain.clone()) + } "text/uri-list" => Some(self.text_uri_list.clone()), "x-special/gnome-copied-files" => Some(self.x_special_gnome_copied_files.clone()), _ => None,