mirror of
https://github.com/rwinkhart/sshyp.git
synced 2026-09-01 14:47:17 -04:00
Fix clipboard clearing on non-Wayland platforms; drop dos2unix as a WSL dependency; suggest openssh-server on Debian and Fedora
Former-commit-id: 046786460edc669fa9b962314953164c1cce078e Former-commit-id: d9f0eeb57d73a0255c9dc713533d08d30413bf90
This commit is contained in:
+24
-10
@@ -9,19 +9,33 @@ sleep(30)
|
||||
|
||||
# store a hash of the current clipboard contents for later comparison
|
||||
_hash_paste = sha512()
|
||||
_hash_paste.update(run('wl-paste', 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():
|
||||
if argv[2] == 'wsl':
|
||||
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'))
|
||||
elif argv[2] == 'wayland':
|
||||
|
||||
elif argv[2] == 'wayland':
|
||||
_hash_paste.update(run('wl-paste', stdout=PIPE).stdout.strip())
|
||||
if argv[1] == _hash_paste.hexdigest():
|
||||
run(('wl-copy', '-c'))
|
||||
elif argv[2] == 'haiku':
|
||||
|
||||
elif argv[2] == 'haiku':
|
||||
_hash_paste.update(run(('clipboard', '-p'), stdout=PIPE).stdout.strip())
|
||||
if argv[1] == _hash_paste.hexdigest():
|
||||
run(('clipboard', '-r'))
|
||||
elif argv[2] == 'mac':
|
||||
|
||||
elif argv[2] == 'mac':
|
||||
_hash_paste.update(run(('pbpaste'), stdout=PIPE).stdout.strip())
|
||||
if argv[1] == _hash_paste.hexdigest():
|
||||
run('pbcopy', input=b'')
|
||||
elif argv[2] == 'termux':
|
||||
|
||||
elif argv[2] == 'termux':
|
||||
_hash_paste.update(run(('termux-clipboard-get'), stdout=PIPE).stdout.strip())
|
||||
if argv[1] == _hash_paste.hexdigest():
|
||||
run(("termux-clipboard-set", "''"))
|
||||
elif argv[2] == 'x11':
|
||||
|
||||
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'))
|
||||
|
||||
Reference in New Issue
Block a user