Fix high CPU usage on empty clipboard

This commit is contained in:
Agatha Lovelace 2023-08-01 20:01:08 +02:00
parent 81cdcc80ed
commit 605b5f5388
Signed by: sorceress
GPG Key ID: 01D0B3AB10CED4F8
1 changed files with 5 additions and 1 deletions

View File

@ -46,6 +46,7 @@ fn main() -> Result<()> {
Ok(contents) => {
// Empty clipboard (Linux)
if contents.is_empty() {
std::thread::sleep(std::time::Duration::from_millis(250));
continue;
};
@ -62,7 +63,10 @@ fn main() -> Result<()> {
};
}
// Empty clipboard (Mac, Windows)
Err(_) => continue,
Err(_) => {
std::thread::sleep(std::time::Duration::from_millis(250));
continue;
}
};
}
}