1
0
Fork 0
mirror of https://github.com/icewind1991/clipboard-sync synced 2026-06-03 18:34:07 +02:00

dont sync empty clipboard

This commit is contained in:
Robin Appelman 2020-03-17 17:56:43 +01:00
commit 4286609e9f

View file

@ -17,7 +17,7 @@ fn handle_command(
) { ) {
if let ClipboardCommand::Set { value, .. } = command { if let ClipboardCommand::Set { value, .. } = command {
let mut clip = current_clipboard.lock().unwrap(); let mut clip = current_clipboard.lock().unwrap();
if *clip != value { if *clip != value && value != "" {
let _ = ctx.set_contents(value.clone()); let _ = ctx.set_contents(value.clone());
*clip = value; *clip = value;
} }
@ -83,7 +83,7 @@ fn clipboard_thread(
thread::sleep(HUNDRED_MS); thread::sleep(HUNDRED_MS);
let new_clipboard = ctx.get_contents().unwrap_or_default(); let new_clipboard = ctx.get_contents().unwrap_or_default();
let mut clip = current_clipboard.lock().unwrap(); let mut clip = current_clipboard.lock().unwrap();
if *clip != new_clipboard { if *clip != new_clipboard && new_clipboard != "" {
send_to_server( send_to_server(
&out, &out,
&ClipboardCommand::Set { &ClipboardCommand::Set {