commit a613aa6b2e00e9328cd5a35f336a00881f3f174c parent 065e91a5fc0cd8cd811d7f734d3ec999f701f294 Author: Streetwalrus Einstein <streetwalrus@codewalr.us> Date: Mon, 14 Sep 2015 15:01:22 +0300 Don't take ownership of PRIMARY, comment about this behavior Diffstat:
M | clipmenud | | | 9 | +++++++-- |
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/clipmenud b/clipmenud @@ -9,10 +9,15 @@ 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" + # Take ownership of clipboard, in case the original application is + # unable to serve the clipboard request + # Exclude primary from this behavior in order not to mess with the owner + [[ $selection != "primary" ]] && xsel --"$selection" | xsel -i --"$selection" else data=$(xclip -o -sel "$selection"; printf x) - xclip -o -sel "$selection" | xclip -i -sel "$selection" + # See above + [[ $selection != "primary" ]] && xclip -o -sel "$selection" | \ + xclip -i -sel "$selection" fi # We add and remove the x so that trailing newlines are not stripped.