Handle rich snippet

This commit is contained in:
BarbUk 2019-10-28 15:06:57 +04:00
parent b930df4b92
commit 7181da294b

11
snippy
View File

@ -89,6 +89,11 @@ strindex() {
[[ "$x" = "$1" ]] && echo -1 || echo "${#x}" [[ "$x" = "$1" ]] && echo -1 || echo "${#x}"
} }
is_rich_snippet() {
file="$1"
grep -q "##richsnippet" "$file"
}
# Move the cursor up or left # Move the cursor up or left
move_cursor() { move_cursor() {
local key=$1 local key=$1
@ -187,7 +192,11 @@ run() {
fi fi
# Copy snippet in clipboard # Copy snippet in clipboard
xsel -b --input < "$tmpfile" if is_rich_snippet "${snippets_directory}/${snippet}"; then
xclip -t text/html -selection clipboard < "$tmpfile"
else
xclip -selection clipboard < "$tmpfile"
fi
# Paste into the current application. # Paste into the current application.
if is_gui; then if is_gui; then