Skip to content

Commit b15e1df

Browse files
committed
Compile wayland code only if the target is linux
1 parent 44727c1 commit b15e1df

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/clipboard.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use base64::{engine::general_purpose, Engine as _};
22
use copypasta_ext::prelude::*;
3+
#[cfg(target_os = "linux")]
34
use copypasta_ext::wayland_bin::WaylandBinClipboardContext;
45
use copypasta_ext::x11_bin::ClipboardContext as BinClipboardContext;
56
use copypasta_ext::x11_fork::ClipboardContext as ForkClipboardContext;
@@ -34,14 +35,19 @@ fn ssh_clipboard(content: &str) -> bool {
3435
)
3536
.is_ok()
3637
}
37-
38+
#[cfg(target_os = "linux")]
3839
fn wayland_clipboard(content: &str) -> bool {
3940
env_var_set("WAYLAND_DISPLAY")
4041
&& WaylandBinClipboardContext::new()
4142
.and_then(|mut ctx| ctx.set_contents(content.to_owned()))
4243
.is_ok()
4344
}
4445

46+
#[cfg(not(target_os = "linux"))]
47+
fn wayland_clipboard(content: &str) -> bool {
48+
false
49+
}
50+
4551
fn other_platform_clipboard(content: &str) -> bool {
4652
BinClipboardContext::new()
4753
.and_then(|mut ctx| ctx.set_contents(content.to_owned()))

0 commit comments

Comments
 (0)