#!/bin/bash # This is a part that executes on remote machine and posts the clipboard there. ## Must not use $HOME for zaitcevx, it points to zaitcev's $HOME. blitzchunk=$HOME/blitz-chunk if [ -f /usr/bin/xsel ]; then xcmd="/usr/bin/xsel -n -b -i" elif [ -f /usr/bin/xclip ]; then xcmd="/usr/bin/xclip -quiet -selection clipboard /dev/fd/0" else echo "blitz: No xsel nor xclip" >&2 exit 1 fi if [ \! -f /bin/cat ]; then echo "blitz: No cat" >&2 exit 1 fi # Use a file for trace / debugging. A pipe is too anonymous. /bin/cat > "$blitzchunk" # # The xclip places itself into background by default, but does not daemonize # correctly, so ssh hangs. Therefore, we background it by hand from shell. # The option -quiet makes xclip to run in the foreground (see above). # Not sure if xsel daemonizes correctly, but we use bash anyway. DISPLAY=:0.0 $xcmd <$blitzchunk >/dev/null 2>&1 &