From 9052dc54f5bb402f9732ab5f67d2ebab15d8ee02 Mon Sep 17 00:00:00 2001 From: zeefaad Date: Fri, 6 Mar 2026 18:43:03 +0100 Subject: [PATCH] x11 feature --- rklipd/src/lib.rs | 3 +++ rklipd/src/main.rs | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/rklipd/src/lib.rs b/rklipd/src/lib.rs index ccdb701..50907d2 100644 --- a/rklipd/src/lib.rs +++ b/rklipd/src/lib.rs @@ -23,12 +23,15 @@ pub enum ClipboardData { } // X11 +#[cfg(feature = "x11")] use clipboard_master::{CallbackResult, ClipboardHandler}; +#[cfg(feature = "x11")] pub struct Handler { pub clipboard_tx: Sender<()>, } +#[cfg(feature = "x11")] impl ClipboardHandler for Handler { fn on_clipboard_change(&mut self) -> CallbackResult { if let Err(e) = self.clipboard_tx.send(()) { diff --git a/rklipd/src/main.rs b/rklipd/src/main.rs index 440944b..004fbe1 100644 --- a/rklipd/src/main.rs +++ b/rklipd/src/main.rs @@ -5,6 +5,7 @@ use std::error::Error; use std::sync::mpsc::channel; // X11 +#[cfg(feature = "x11")] fn main() -> Result<(), Box> { let mut clipboard = Clipboard::new()?; let path = "clipboard.json"; @@ -36,3 +37,8 @@ fn main() -> Result<(), Box> { Ok(()) } // X11 + +#[cfg(not(feature = "x11"))] +fn main() -> Result<(), Box> { + Ok(()) +}