aboutsummaryrefslogtreecommitdiff
path: root/src/client/clipboard_forwarding.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/clipboard_forwarding.rs')
-rw-r--r--src/client/clipboard_forwarding.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/client/clipboard_forwarding.rs b/src/client/clipboard_forwarding.rs
new file mode 100644
index 00000000..2de5f49f
--- /dev/null
+++ b/src/client/clipboard_forwarding.rs
@@ -0,0 +1,16 @@
+use super::*;
+
+pub(super) fn decode_clipboard_payload(data: &str) -> Option<Vec<u8>> {
+ use base64::Engine;
+
+ base64::engine::general_purpose::STANDARD.decode(data).ok()
+}
+
+pub(super) fn forward_clipboard(data: &str) -> bool {
+ let Some(bytes) = decode_clipboard_payload(data) else {
+ warn!("received invalid clipboard payload from server");
+ return false;
+ };
+ crate::selection::write_osc52_bytes(&bytes);
+ true
+}