mirror of
https://github.com/rwinkhart/sshyp.git
synced 2026-09-06 09:07:13 -04:00
(WSL) Port new clipboard clear behavior to WSL
Former-commit-id: e1d96418abae79f6af75d72eeb6279e661196bd5 Former-commit-id: 0b345de72d9dc13de2f0db7c26264e0deb685965
This commit is contained in:
@@ -9,7 +9,10 @@ arguments, replacement = argv[1:], None
|
||||
if len(arguments) > 0:
|
||||
if arguments[0] == 'WSL':
|
||||
replacement = """run(('powershell.exe', '-c', "Set-Clipboard '" + _copy_subject.replace("'", "''") + "'"))
|
||||
Popen("sleep 30; powershell.exe -c Set-Clipboard ''", shell=True, stdout=DEVNULL, stderr=DEVNULL)"""
|
||||
Popen("sleep 30; temp=$(echo \\"$(powershell.exe -Command \\'Get-FileHash -InputStream $([IO.MemoryStream]"
|
||||
"::new([byte[]][char[]]\\"$(Get-Clipboard)\\")) -Algorithm SHA512 | Select-Object -ExpandProperty "
|
||||
f"Hash\\')\\" | dos2unix); test \\'{_hash.hexdigest().upper()}\\' = \\"$temp\\" && powershell.exe -c "
|
||||
"Set-Clipboard", shell=True, stdout=DEVNULL, stderr=DEVNULL)"""
|
||||
elif arguments[0] == 'MAC':
|
||||
replacement = """run('pbcopy', stdin=Popen(('printf', _copy_subject.replace('\\\\\\', '\\\\\\\\\\\\\\')
|
||||
.replace('%', '%%')), stdout=PIPE).stdout)
|
||||
@@ -24,7 +27,8 @@ if len(arguments) > 0:
|
||||
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}\\' = \\"$(printf \\"$(wl-paste)\\" | sha512sum)\\" && wl-copy -c", shell=True)
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user