From b532890a9d00baf1f7ed202aafa4dfffa15b88cc Mon Sep 17 00:00:00 2001 From: thee veventh Date: Sun, 5 Dec 2021 09:51:36 -0500 Subject: [PATCH 1/5] Added ability to insert generate dynamically generated text. --- texpander.sh | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/texpander.sh b/texpander.sh index 5e7e9ca..91e9454 100755 --- a/texpander.sh +++ b/texpander.sh @@ -36,12 +36,20 @@ then # Preserve the current value of the clipboard clipboard=$(xsel -b -o) - # Put text in primary buffer for Shift+Insert pasting - echo -n "$(cat "$path")" | xsel -p -i - - # Put text in clipboard selection for apps like Firefox that - # insist on using the clipboard for all pasting - echo -n "$(cat "$path")" | xsel -b -i + if [ "${path: -4}" == ".cmd" ] + then + # Put text in primary buffer for Shift+Insert pasting + echo -n $($(cat "$path")) | xsel -p -i + # Put text in clipboard selection for apps like Firefox that + # insist on using the clipboard for all pasting + echo -n $($(cat "$path")) | xsel -b -i + else + # Put text in primary buffer for Shift+Insert pasting + echo -n "$(cat "$path")" | xsel -p -i + # Put text in clipboard selection for apps like Firefox that + # insist on using the clipboard for all pasting + echo -n "$(cat "$path")" | xsel -b -i + fi # Paste text into current active window sleep 0.3 From 9434adf44f2001ea11bc56da3703cbbebad5c466 Mon Sep 17 00:00:00 2001 From: Stephan Eisenbach <3224960+stephaneisenbach@users.noreply.github.com> Date: Tue, 27 Sep 2022 17:24:22 +0200 Subject: [PATCH 2/5] Ignore hidden . files in texpander directory --- texpander.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/texpander.sh b/texpander.sh index 5e7e9ca..7896b6e 100755 --- a/texpander.sh +++ b/texpander.sh @@ -21,7 +21,7 @@ base_dir=$(realpath "${HOME}/.texpander") shopt -s globstar # Find regular files in base_dir, pipe output to sed -abbrvs=$(find "${base_dir}" -type f | sort | sed "s?^${base_dir}/??g") +abbrvs=$(find "${base_dir}" -type f \( ! -iname ".*" \) | sort | sed "s?^${base_dir}/??g") # 'Echo'ing the options instead of passing them directly # to zenity allows names like '+1' or '-1' From afa4cda9f404c87f58e4b3ce1bf455a36f8b0b0e Mon Sep 17 00:00:00 2001 From: Stephan Eisenbach <3224960+stephaneisenbach@users.noreply.github.com> Date: Fri, 21 Feb 2025 17:26:03 +0100 Subject: [PATCH 3/5] Fix: Remove unnecessary tr conversion to preserve file names with spaces --- texpander.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/texpander.sh b/texpander.sh index 7896b6e..3707d7f 100755 --- a/texpander.sh +++ b/texpander.sh @@ -25,7 +25,7 @@ abbrvs=$(find "${base_dir}" -type f \( ! -iname ".*" \) | sort | sed "s?^${base_ # 'Echo'ing the options instead of passing them directly # to zenity allows names like '+1' or '-1' -name=$(echo ${abbrvs} | tr ' ' '\n' | zenity --list --title=Texpander --width=275 --height=400 --column=Abbreviations) +name=$(echo "$abbrvs" | zenity --list --title="Texpander" --width=275 --height=400 --column="Abbreviations") path="${base_dir}/${name}" From bca7675f901d702425aa35e3a8f1290fac9d3c8d Mon Sep 17 00:00:00 2001 From: Stephan Eisenbach <3224960+stephaneisenbach@users.noreply.github.com> Date: Fri, 21 Feb 2025 17:40:58 +0100 Subject: [PATCH 4/5] Fix typo --- texpander.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/texpander.sh b/texpander.sh index 0d8d12e..44bf9d7 100755 --- a/texpander.sh +++ b/texpander.sh @@ -14,7 +14,7 @@ if [ ! -d ${HOME}/.texpander ]; then mkdir ${HOME}/.texpander fi -# Store base directory path, expand complete path using HOME environemtn variable +# Store base directory path, expand complete path using HOME environment variable base_dir=$(realpath "${HOME}/.texpander") # Set globstar shell option (turn on) ** for filename matching glob patterns on subdirectories of ~/.texpander From bebeb75f5669a91b7e1c40973db4ccd2f0cc50e2 Mon Sep 17 00:00:00 2001 From: Stephan Eisenbach <3224960+stephaneisenbach@users.noreply.github.com> Date: Fri, 21 Feb 2025 17:56:42 +0100 Subject: [PATCH 5/5] Add interactive search filter in selection dialog using --mid-search --- texpander.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/texpander.sh b/texpander.sh index 44bf9d7..0f5bb5b 100755 --- a/texpander.sh +++ b/texpander.sh @@ -25,7 +25,7 @@ abbrvs=$(find "${base_dir}" -type f \( ! -iname ".*" \) | sort | sed "s?^${base_ # 'Echo'ing the options instead of passing them directly # to zenity allows names like '+1' or '-1' -name=$(echo "$abbrvs" | zenity --list --title="Texpander" --width=275 --height=400 --column="Abbreviations") +name=$(echo "$abbrvs" | zenity --list --title="Texpander" --width=275 --height=400 --column="Abbreviations" --mid-search) path="${base_dir}/${name}"