summaryrefslogtreecommitdiffstats
path: root/src/clipboard.rs
diff options
context:
space:
mode:
authorRemo Senekowitsch <contact@remlse.dev>2023-03-05 14:07:47 +0100
committerextrawurst <776816+extrawurst@users.noreply.github.com>2023-03-07 18:50:09 +0100
commit63f230f0d1de5b06b325b11924eb41f6120b30da (patch)
tree412dd1dcbfd4e54a2bec15fb9a3fe9d6055968e2 /src/clipboard.rs
parent3ceeb33c25ac2b6a509bf933df5576d10ac3a55c (diff)
fix freeze on copy with wl-copy
Diffstat (limited to 'src/clipboard.rs')
-rw-r--r--src/clipboard.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/clipboard.rs b/src/clipboard.rs
index 2d492701..bf961d20 100644
--- a/src/clipboard.rs
+++ b/src/clipboard.rs
@@ -49,14 +49,10 @@ fn exec_copy_with_args(
}
}
-fn exec_copy(command: &str, text: &str) -> Result<()> {
- exec_copy_with_args(command, &[], text, true)
-}
-
#[cfg(all(target_family = "unix", not(target_os = "macos")))]
pub fn copy_string(text: &str) -> Result<()> {
if std::env::var("WAYLAND_DISPLAY").is_ok() {
- return exec_copy("wl-copy", text);
+ return exec_copy_with_args("wl-copy", &[], text, false);
}
if exec_copy_with_args(
@@ -78,6 +74,11 @@ pub fn copy_string(text: &str) -> Result<()> {
Ok(())
}
+#[cfg(any(target_os = "macos", windows))]
+fn exec_copy(command: &str, text: &str) -> Result<()> {
+ exec_copy_with_args(command, &[], text, true)
+}
+
#[cfg(target_os = "macos")]
pub fn copy_string(text: &str) -> Result<()> {
exec_copy("pbcopy", text)