From 154905792a73cce823972d65914ddf425c8d311a Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Mon, 3 Apr 2023 20:41:28 -0400 Subject: [PATCH] Added WSL clipboard support Former-commit-id: 0d365e6ec00549a9578e7adc4330a89cc8b5dabd Former-commit-id: 8a3fe31f06f92e4298dd21521b84500f3ca48734 --- lib/sshyp.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/sshyp.py b/lib/sshyp.py index f84481f..7c8674d 100755 --- a/lib/sshyp.py +++ b/lib/sshyp.py @@ -697,7 +697,10 @@ def copy_data(): # copies a specified field of an entry to the clipboard _index = 2 elif arguments[2] in ('note', '-n'): _index = 3 - if 'WAYLAND_DISPLAY' in environ: # Wayland clipboard detection + if 'WSL_DISTRO_NAME' in environ: # WSL clipboard detection + run(['pwsh.exe', '-c', 'Set-Clipboard', _copy_line[_index].rstrip()]) + Popen("sleep 30; pwsh.exe -c 'echo \"\" | Set-Clipboard'", shell=True) + elif 'WAYLAND_DISPLAY' in environ: # Wayland clipboard detection run(['wl-copy', _copy_line[_index].rstrip()]) Popen('sleep 30; wl-copy -c', shell=True) elif uname()[0] == 'Haiku': # Haiku clipboard detection