From 4155edab8d123b767ddad67e24ca2d4c50f31ece Mon Sep 17 00:00:00 2001 From: Mattias Eriksson Date: Wed, 7 Feb 2024 17:25:40 +0100 Subject: Add support for primary clipboard --- core/src/clipboard.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'core/src/clipboard.rs') diff --git a/core/src/clipboard.rs b/core/src/clipboard.rs index 081b4004..ff2e31d0 100644 --- a/core/src/clipboard.rs +++ b/core/src/clipboard.rs @@ -8,6 +8,12 @@ pub trait Clipboard { /// Writes the given text contents to the [`Clipboard`]. fn write(&mut self, contents: String); + + /// Reads the current content of Primary as text. + fn read_primary(&self) -> Option; + + /// Writes the given text contents to Primary. + fn write_primary(&mut self, contents: String); } /// A null implementation of the [`Clipboard`] trait. @@ -20,4 +26,10 @@ impl Clipboard for Null { } fn write(&mut self, _contents: String) {} + + fn read_primary(&self) -> Option { + None + } + + fn write_primary(&mut self, _contents: String) {} } -- cgit