Add port-job for making clipclear.py platform-specific

Former-commit-id: 6aafd4dfcddefc31bf61d3018b63ef48c156d8a8
Former-commit-id: c016e6872d71bc4bb347d85cf964dd9e7b7fe149
This commit is contained in:
2023-10-23 13:51:11 -04:00
parent 362b1aa025
commit edf31f9a7c
2 changed files with 40 additions and 21 deletions
+4 -3
View File
@@ -6,12 +6,12 @@ from time import sleep
# set period of time to wait before attempting to clear clipboard
sleep(30)
# store a hash of the current clipboard contents for later comparison
# enable the storing of clipboard contents hash for later comparison
_hash_paste = sha512()
# PORT START CLIPCLEAR
if argv[2] == 'wsl':
_hash_paste.update(run(('powershell.exe', '-c', 'Get-Clipboard'), stdout=PIPE).stdout.strip())
# if the supplied hash matches the hash of the current clipboard contents, clear the clipboard
if argv[1] == _hash_paste.hexdigest():
run(('powershell.exe', '-c', 'Set-Clipboard'))
@@ -39,3 +39,4 @@ elif argv[2] == 'x11':
_hash_paste.update(run(('xclip', '-o', '-sel', 'c'), stdout=PIPE).stdout.strip())
if argv[1] == _hash_paste.hexdigest():
run(('xclip', '-i', '/dev/null', '-sel', 'c'))
# PORT END CLIPCLEAR