diff --git a/Cargo.toml b/Cargo.toml
index c53131b682..c5f565d7b2 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -144,7 +144,7 @@ errno = "0.3"
# `XKeysymToString` tier of `modify_event_symbol`, and this is that table
# without an X11 or xkbcommon dependency, so it works on every platform.
keysymdefs = "0.2"
-rustix = { version = "1", features = ["fs"] }
+rustix = { version = "1", features = ["event", "fs"] }
inotify = "0.11"
fs4 = { version = "1", features = ["sync"] }
sysinfo = "0.39"
diff --git a/crates/neomacs-display-runtime/src/clipboard.rs b/crates/neomacs-display-runtime/src/clipboard.rs
index 43628ca846..8534b37b88 100644
--- a/crates/neomacs-display-runtime/src/clipboard.rs
+++ b/crates/neomacs-display-runtime/src/clipboard.rs
@@ -11,6 +11,9 @@ use arboard::{ClearExtLinux, GetExtLinux, LinuxClipboardKind, SetExtLinux};
#[cfg(target_os = "linux")]
use raw_window_handle::{HasDisplayHandle, RawDisplayHandle};
+#[cfg(target_os = "linux")]
+mod wayland_data_control;
+
const WORKER_SHUTDOWN_TIMEOUT: Duration = Duration::from_millis(250);
const REQUEST_QUEUE_CAPACITY: usize = 32;
@@ -55,10 +58,7 @@ impl ClipboardService {
let clipboard = unsafe {
smithay_clipboard::Clipboard::new(raw_display.display.as_ptr())
};
- return Self::start(WaylandClipboard {
- clipboard,
- _display_owner: display,
- });
+ return Self::start(WaylandClipboard::new(clipboard, display));
}
}
_ => {
@@ -372,11 +372,91 @@ impl ClipboardBackend for ArboardClipboard {
#[cfg(target_os = "linux")]
struct WaylandClipboard {
- // Field order is significant: drop the protocol worker before its display.
+ // Field order is significant: drop the protocol objects before their display.
clipboard: smithay_clipboard::Clipboard,
+ data_control: DataControl,
_display_owner: OwnedDisplayHandle,
}
+/// Lazily bound fallback for CLIPBOARD reads; see `wayland_data_control`.
+#[cfg(target_os = "linux")]
+enum DataControl {
+ Unbound,
+ Unavailable,
+ Bound(wayland_data_control::DataControlReader),
+}
+
+#[cfg(target_os = "linux")]
+impl WaylandClipboard {
+ fn new(clipboard: smithay_clipboard::Clipboard, display: OwnedDisplayHandle) -> Self {
+ Self {
+ clipboard,
+ data_control: DataControl::Unbound,
+ _display_owner: display,
+ }
+ }
+
+ fn data_control_text(&mut self) -> Result