Add support for archives

This commit is contained in:
Nikita Ivanov 2022-06-17 22:50:17 +05:00
parent 46d006f82e
commit 16a52340de
No known key found for this signature in database
GPG Key ID: 6E656AC5B97B5133
3 changed files with 55 additions and 0 deletions

View File

@ -19,6 +19,10 @@ exists() {
command -v "$1" >/dev/null
}
check_exists() {
exists "$@" || exit 127
}
send_image() {
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"

3
prev/atool.sh Normal file
View File

@ -0,0 +1,3 @@
check_exists atool
atool -l -- "$f" | cut -d ' ' -f 6-

View File

@ -44,6 +44,54 @@ Preview b_previews[] = {
PR(NULL, "text", "x-diff", colordiff),
PR(NULL, "text", "x-patch", colordiff),
PR("tar.gz", NULL, NULL, atool),
PR("tgz", NULL, NULL, atool),
PR("tgz", NULL, NULL, atool),
PR("tar.gz", NULL, NULL, atool),
PR("tgz", NULL, NULL, atool),
PR("tar.bz", NULL, NULL, atool),
PR("tbz", NULL, NULL, atool),
PR("tar.bz2", NULL, NULL, atool),
PR("tbz2", NULL, NULL, atool),
PR("tar.Z", NULL, NULL, atool),
PR("tZ", NULL, NULL, atool),
PR("tar.lzo", NULL, NULL, atool),
PR("tzo", NULL, NULL, atool),
PR("tar.lz", NULL, NULL, atool),
PR("tlz", NULL, NULL, atool),
PR("tar.xz", NULL, NULL, atool),
PR("txz", NULL, NULL, atool),
PR("tar.7z", NULL, NULL, atool),
PR("t7z", NULL, NULL, atool),
PR("tar", NULL, NULL, atool),
PR("zip", NULL, NULL, atool),
PR("jar", NULL, NULL, atool),
PR("war", NULL, NULL, atool),
PR("rar", NULL, NULL, atool),
PR("lha", NULL, NULL, atool),
PR("lzh", NULL, NULL, atool),
PR("7z", NULL, NULL, atool),
PR("alz", NULL, NULL, atool),
PR("ace", NULL, NULL, atool),
PR("a", NULL, NULL, atool),
PR("arj", NULL, NULL, atool),
PR("arc", NULL, NULL, atool),
PR("rpm", NULL, NULL, atool),
PR("deb", NULL, NULL, atool),
PR("cab", NULL, NULL, atool),
PR("gz", NULL, NULL, atool),
PR("bz", NULL, NULL, atool),
PR("bz2", NULL, NULL, atool),
PR("Z", NULL, NULL, atool),
PR("lzma", NULL, NULL, atool),
PR("lzo", NULL, NULL, atool),
PR("lz", NULL, NULL, atool),
PR("xz", NULL, NULL, atool),
PR("rz", NULL, NULL, atool),
PR("lrz", NULL, NULL, atool),
PR("7z", NULL, NULL, atool),
PR("cpio", NULL, NULL, atool),
};
/* vim: set nowrap: */