(MacOS) Port new clipboard behavior to MacOS

Former-commit-id: bd887c5ee6a75130b8c994034708ae7893764251
Former-commit-id: e1621ed1a986f731c8217d741fd84a42196cb4e9
This commit is contained in:
2023-09-26 20:29:51 -04:00
parent 20cdc27b88
commit 7259a8732c
2 changed files with 4 additions and 2 deletions
+2 -1
View File
@@ -566,7 +566,8 @@ def copy_data():
elif uname()[0] == 'Darwin':
run('pbcopy', stdin=Popen(('printf', _copy_subject.replace('\\', '\\\\').replace('%', '%%')), stdout=PIPE)
.stdout)
Popen("sleep 30; printf '' | pbcopy", shell=True)
Popen(f"sleep 30; test \'{_hash.hexdigest() + 2 * ' ' + '-'}\' = \"$(printf \"$(pbpaste)\" | shasum -a 512)\" "
"&& printf '' | pbcopy", shell=True)
# Termux (Android) clipboard detection
elif isdir("/data/data/com.termux"):
run(('termux-clipboard-set', _copy_subject))
+2 -1
View File
@@ -16,7 +16,8 @@ if len(arguments) > 0:
elif arguments[0] == 'MAC':
replacement = """run('pbcopy', stdin=Popen(('printf', _copy_subject.replace('\\\\\\', '\\\\\\\\\\\\\\')
.replace('%', '%%')), stdout=PIPE).stdout)
Popen("sleep 30; printf '' | pbcopy", shell=True)"""
Popen(f"sleep 30; test \\'{_hash.hexdigest() + 2 * ' ' + '-'}\\' = \\"$(printf \\"$(pbpaste)\\" | shasum -a 512)\\" "
"&& printf '' | pbcopy", shell=True)"""
elif arguments[0] == 'HAIKU':
replacement = """run(('clipboard', '-c', _copy_subject))
Popen(f"sleep 30; test \\'{_hash.hexdigest() + 2 * ' ' + '-'}\\' = \\"$(printf \\"$(clipboard -p)\\" | sha512sum)\\" "