[PATCH] Add support for Windows clipboard (WSL)

Douglas Silva doug.hs at proton.me
Sat Oct 15 23:59:13 UTC 2022


This makes the -c (copy to clipboard) option work on WSL, by using the clip.exe command if it's available. I picked $WSL_DISTRO_NAME to test for it.

Note that I didn't set "paste_cmd" or "display_name". I couldn't find any paste command for Windows, and I don't understand what they're used for.

---
 src/password-store.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/password-store.sh b/src/password-store.sh
index 22e818f..7f64b68 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -155,7 +155,9 @@ check_sneaky_paths() {
 #
 
 clip() {
-	if [[ -n $WAYLAND_DISPLAY ]] && command -v wl-copy &> /dev/null; then
+	if [[ -n $WSL_DISTRO_NAME ]] && command -v clip.exe &> /dev/null; then
+		local copy_cmd=( clip.exe )
+	elif [[ -n $WAYLAND_DISPLAY ]] && command -v wl-copy &> /dev/null; then
 		local copy_cmd=( wl-copy )
 		local paste_cmd=( wl-paste -n )
 		if [[ $X_SELECTION == primary ]]; then
-- 
2.34.1




More information about the Password-Store mailing list