(X11) Port new clipboard clear behavior to X11

Former-commit-id: 11edd45f8ccaa6de548d6656ef50cd0c1bdff0b4
Former-commit-id: 1fb779b6d27937d83802f50fb6857f24ec7765ed
This commit is contained in:
2023-09-25 13:53:59 -04:00
parent 1f4e7d5cae
commit e010180219
2 changed files with 7 additions and 5 deletions
+3 -2
View File
@@ -556,7 +556,7 @@ def copy_data():
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)
"&& wl-copy -c", shell=True)
# Haiku clipboard detection
elif uname()[0] == 'Haiku':
run(('clipboard', '-c', _copy_subject))
@@ -574,7 +574,8 @@ def copy_data():
elif 'DISPLAY' in environ:
run(('xclip', '-se', 'c'), stdin=Popen(('printf', _copy_subject.replace('\\', '\\\\')
.replace('%', '%%')), stdout=PIPE).stdout)
Popen("sleep 30; printf '' | xclip -se c", shell=True)
Popen(f"sleep 30; test \'{_hash.hexdigest() + 2*' ' + '-'}\' = \"$(printf \"$(xclip -o -se c)\" | sha512sum)\" "
"&& xclip -i /dev/null -se 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')