From 1c1f8fdf6e41361345156e1a6e2f03e8d5fb3902 Mon Sep 17 00:00:00 2001 From: Ashley Wulber Date: Fri, 27 Mar 2026 11:51:16 -0400 Subject: [PATCH] fix: retry reading clipboard if data is empty --- src/app.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/app.rs b/src/app.rs index 0561db4..19dc54d 100644 --- a/src/app.rs +++ b/src/app.rs @@ -3890,6 +3890,24 @@ impl Application for App { // Use cached clipboard data if available (needed for Wayland popups) match &self.clipboard_cache { ClipboardCache::Files(contents) => { + if contents.paths.is_empty() { + return iced::Task::future(tokio::time::sleep( + std::time::Duration::from_millis(300), + )) + .discard() + .chain( + clipboard::read_data::().map( + move |contents_opt| match contents_opt { + Some(contents) => cosmic::action::app( + Message::PasteContents(to.clone(), contents), + ), + None => { + cosmic::action::app(Message::PasteImage(to.clone())) + } + }, + ), + ); + } return self .update(Message::PasteContents(to.clone(), contents.clone())); }