fix: retry reading clipboard if data is empty
This commit is contained in:
parent
cf328771c3
commit
1c1f8fdf6e
1 changed files with 18 additions and 0 deletions
18
src/app.rs
18
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::<ClipboardPaste>().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()));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue