wslu
wslu copied to clipboard
Suggestion: a clipboard manager
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!
Have you tried using clip.exe
on WSL? Technically saying this should just work and do not need any wrapper
Yes, one example of why a wrapper that follows UNIX conventions would be that echo text | clip.exe
doesn’t work.
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}
}
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