2021-10-07 22:54:37 +02:00
|
|
|
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
exec 2>&1
|
|
|
|
|
|
|
|
SEL="../selection"
|
|
|
|
|
|
|
|
|
|
|
|
# "xsel --nodetach --input" with an empty input will still exit immediately,
|
|
|
|
# so we need to make sure the selection never is empty:
|
|
|
|
[ -s "$SEL" ] || echo >| "$SEL"
|
|
|
|
|
|
|
|
xsel --nodetach --logfile /dev/stdout --"$(basename "`pwd`")" \
|
|
|
|
--input < "$SEL"
|
|
|
|
|
|
|
|
# something else grabbed the selection. pull it over here:
|
2021-10-08 01:12:56 +02:00
|
|
|
sleep 0.2
|
2021-10-07 22:54:37 +02:00
|
|
|
xsel --nodetach --logfile /dev/stdout --"$(basename "`pwd`")" \
|
|
|
|
--output > "$SEL".new
|
|
|
|
# see above:
|
|
|
|
[ -s "$SEL" ] || echo >| "$SEL"
|
|
|
|
mv "$SEL".new "$SEL"
|
|
|
|
sv term ../primary ../secondary ../clipboard
|