wslu icon indicating copy to clipboard operation
wslu copied to clipboard

Suggestion: a clipboard manager

Open lenormf opened this issue 2 years ago • 4 comments

Hi,

It’d be nice to have a utility that allows interacting with the host clipboard in a UNIX-y manner: read on stdin via pipe, via redirection etc.

Thanks!

lenormf avatar Mar 01 '22 11:03 lenormf

Have you tried using clip.exe on WSL? Technically saying this should just work and do not need any wrapper

patrick330602 avatar Mar 23 '22 04:03 patrick330602

Yes, one example of why a wrapper that follows UNIX conventions would be that echo text | clip.exe doesn’t work.

lenormf avatar Mar 24 '22 05:03 lenormf

I use a bash function clip which converts the line-ending to Windows and copies to the clipboard.

clip () {
        local clip_path=/mnt/c/Windows/System32/Clip.exe
        local in=$1
        [ ! -f ${clip_path} ] && echo "${clip_path} binary not found" && return 1
        [ -z "$in" ] && in=`cat`
        echo ${in} | sed 's#\n$#\r\n#g' | ${clip_path}
}

kforeverisback avatar Mar 28 '22 16:03 kforeverisback

I use a bash function clip which converts the line-ending to Windows and copies to the clipboard.

clip () {
        local clip_path=/mnt/c/Windows/System32/Clip.exe
        local in=$1
        [ ! -f ${clip_path} ] && echo "${clip_path} binary not found" && return 1
        [ -z "$in" ] && in=`cat`
        echo ${in} | sed 's#\n$#\r\n#g' | ${clip_path}
}

The script you provided hangs for me interestingly スクリーンショット 2022-03-29 午前8 57 12

patrick330602 avatar Mar 29 '22 01:03 patrick330602