From 4e4775e877d8bedb4774bc7d31ed9bf6689ab9cd Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Sun, 12 Sep 2021 12:55:15 +0200 Subject: [PATCH] Rework sniplet command Signed-off-by: Knut Ahlers --- bin/sniplet | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bin/sniplet b/bin/sniplet index 3f5f061..668828b 100755 --- a/bin/sniplet +++ b/bin/sniplet @@ -15,7 +15,7 @@ trap cleanup EXIT } # Find sniplet files -names=$(find "${sniplet_dir}" -type f | sed "s|${sniplet_dir}||" | sort) +names=$(find "${sniplet_dir}" -type f | sed "s|${sniplet_dir}/||" | sort) # Let the user select one of them name=$( @@ -36,15 +36,15 @@ sniplet="${sniplet_dir}/${name}" } # Store clipboard away -xsel -b -o >"${tmpdir}/b" -xsel -p -o >"${tmpdir}/p" +xclip -selection clipboard -o >"${tmpdir}/clipboard" +xclip -selection primary -o >"${tmpdir}/primary" # Render the sniplet using korvike for templating -korvike -i "${sniplet}" -o "${tmpdir}/s" +korvike -i "${sniplet}" -o "${tmpdir}/sniplet" # Set clipboard with sniplet -xsel -b -i <"${tmpdir}/s" -xsel -p -i <"${tmpdir}/s" +xclip -selection clipboard -i <"${tmpdir}/sniplet" +xclip -selection primary -i <"${tmpdir}/sniplet" # Do the paste magic sleep 0.3 @@ -52,5 +52,5 @@ xdotool key shift+Insert sleep 0.5 # Restore clipboard -xsel -b -i <"${tmpdir}/b" -xsel -p -i <"${tmpdir}/p" +xclip -selection clipboard -i <"${tmpdir}/clipboard" +xclip -selection primary -i <"${tmpdir}/primary"