Take over the clipboard to persist it after the owner quits

This commit is contained in:
Streetwalrus Einstein 2015-09-11 23:29:14 +03:00
parent 7c87f80234
commit 065e91a5fc

View file

@ -9,8 +9,10 @@ while sleep "${CLIPMENUD_SLEEP:-0.5}"; do
for selection in clipboard primary; do
if type -p xsel >/dev/null 2>&1; then
data=$(xsel --"$selection"; printf x)
xsel --"$selection" | xsel -i --"$selection"
else
data=$(xclip -o -sel "$selection"; printf x)
xclip -o -sel "$selection" | xclip -i -sel "$selection"
fi
# We add and remove the x so that trailing newlines are not stripped.