From eb4fae3e9e4a9c85a465f554321db0fec8b8a2e1 Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Tue, 26 Sep 2023 19:03:07 -0400 Subject: [PATCH] Fixed new clipboard clear behavior on FreeBSD Former-commit-id: e276182b11c518bc7b880eaebb7d9c8fd528761b Former-commit-id: fc1f067c5c0df86109795feca05527be5322d829 --- lib/sshyp.py | 4 ++-- package.sh | 2 +- port-jobs/CLIPBOARD.py | 11 +++++++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/sshyp.py b/lib/sshyp.py index 880a9e0..644041a 100755 --- a/lib/sshyp.py +++ b/lib/sshyp.py @@ -574,8 +574,8 @@ def copy_data(): elif 'DISPLAY' in environ: run(('xclip', '-sel', 'c'), stdin=Popen(('printf', _copy_subject.replace('\\', '\\\\') .replace('%', '%%')), stdout=PIPE).stdout) - Popen(f"sleep 30; test \'{_hash.hexdigest() + 2*' ' + '-'}\' = \"$(printf \"$(xclip -o -sel c)\" | sha512sum)\" " - "&& xclip -i /dev/null -sel c", shell=True) + Popen(f"sleep 30; test \'{_hash.hexdigest() + 2*' ' + '-'}\' = \"$(printf \"$(xclip -o -sel c)\" | sha512sum)\"" + " && xclip -i /dev/null -sel c", shell=True) else: print('\n\u001b[38;5;9merror: clipboard tool could not be determined\n\nnote that the clipboard does not ' 'function in a raw tty\u001b[0m\n') diff --git a/package.sh b/package.sh index 3c458aa..43641dd 100755 --- a/package.sh +++ b/package.sh @@ -388,7 +388,7 @@ printf "/usr/bin/sshyp cp lib/* port-jobs/working/ cd port-jobs ./CLIPTOOL.py LINUX - ./CLIPBOARD.py LINUX + ./CLIPBOARD.py BSD ./UNAME.py TMP ./COMMENTS.py ALL ./BLANKS.py diff --git a/port-jobs/CLIPBOARD.py b/port-jobs/CLIPBOARD.py index acd3658..a9ee081 100755 --- a/port-jobs/CLIPBOARD.py +++ b/port-jobs/CLIPBOARD.py @@ -34,6 +34,17 @@ if len(arguments) > 0: .replace('\\\\\\', '\\\\\\\\\\\\\\').replace('%', '%%')), stdout=PIPE).stdout) Popen(f"sleep 30; test \\'{_hash.hexdigest() + 2*' ' + '-'}\\' = \\"$(printf \\"$(xclip -o -sel c)\\" | sha512sum)\\" " "&& xclip -i /dev/null -sel c", shell=True)""" + elif arguments[0] == 'BSD': + replacement = """if 'WAYLAND_DISPLAY' in environ: + run('wl-copy', stdin=Popen(('printf', _copy_subject + .replace('\\\\\\', '\\\\\\\\\\\\\\').replace('%', '%%')), stdout=PIPE).stdout) + Popen(f"sleep 30; test \\'{_hash.hexdigest() + 2*' ' + '-'}\\' = \\"$(printf \\"$(wl-paste)\\" | sha512sum)\\" " + "&& wl-copy -c", shell=True) + else: + run(('xclip', '-sel', 'c'), stdin=Popen(('printf', _copy_subject + .replace('\\\\\\', '\\\\\\\\\\\\\\').replace('%', '%%')), stdout=PIPE).stdout) + Popen(f"sleep 30; test \\'{_hash.hexdigest()}\\' = \\"$(printf \\"$(xclip -o -sel c)\\" | sha512sum)\\" " + "&& xclip -i /dev/null -sel c", shell=True)""" else: s_exit()