Add a new version of bashdown

This commit is contained in:
BarbUk 2019-05-17 17:46:00 +04:00
parent ee60bd3432
commit 00df7628e9

11
snippy
View File

@ -67,6 +67,15 @@ bashdown() {
done
}
# Simplified version of bashdown, use echo and bash var search and replace
# Better handling of symbol char
bashdown2() {
while IFS= read -r line; do
line="$(eval "echo \"${line//\"/\\\"}\"")"
echo "$line"
done
}
# Detect if focused app is a terminal or a gui
is_gui() {
name="$(xprop -id "$(xdotool getwindowfocus)" WM_CLASS | cut -d'"' -f2 | tr '[:upper:]' '[:lower:]')"
@ -129,7 +138,7 @@ run() {
# default action
else
content="$( bashdown < "${snippets_directory}/${snippet}" )"
content="$( bashdown2 < "${snippets_directory}/${snippet}" )"
fi
printf "%s" "$content" > "$tmpfile"