This commit is contained in:
Nikita Ivanov 2022-05-31 23:47:04 +05:00
parent ba00ea1435
commit a1d9f8d5d9
No known key found for this signature in database
GPG Key ID: 6E656AC5B97B5133

View File

@ -19,14 +19,6 @@ exists() {
command -v "$1" > /dev/null command -v "$1" > /dev/null
} }
check_exists() {
[ $? = 127 ] && exit 127
}
cache() {
[ -n "$cache_valid" ]
}
send_image() { send_image() {
path="$(printf '%s' "$1" | sed 's/\\/\\\\/g; s/"/\\"/g')" path="$(printf '%s' "$1" | sed 's/\\/\\\\/g; s/"/\\"/g')"
printf '{ "action": "add", "identifier": "preview", "x": %d, "y": %d, "width": %d, "height": %d, "scaler": "contain", "scaling_position_x": 0.5, "scaling_position_y": 0.5, "path": "%s"}\n' "$x" "$y" "$w" "$h" "$path" > "$fifo" printf '{ "action": "add", "identifier": "preview", "x": %d, "y": %d, "width": %d, "height": %d, "scaler": "contain", "scaling_position_x": 0.5, "scaling_position_y": 0.5, "path": "%s"}\n' "$x" "$y" "$w" "$h" "$path" > "$fifo"
@ -34,7 +26,7 @@ send_image() {
convert_and_show_image() { convert_and_show_image() {
setup_fifo setup_fifo
cache || "$@" || check_exists [ -n "$cache_valid" ] || "$@" || exit "$?"
send_image "$cache_f" send_image "$cache_f"
exit 1 exit 1
} }