Images: Added termpix backend

This commit is contained in:
Dylan Araps 2017-02-09 10:36:21 +11:00
parent 2b2a9c19dc
commit ca54e76f52
2 changed files with 16 additions and 6 deletions

View file

@ -1985,7 +1985,7 @@ image_backend() {
"ascii") get_ascii ;;
"off") image_backend="off" ;;
"caca" | "catimg" | "jp2a" | "iterm2" | "tycat" | "w3m" | "sixel")
"caca" | "catimg" | "jp2a" | "iterm2" | "termpix" | "tycat" | "w3m" | "sixel")
get_image_source
if [[ ! -f "$image" ]]; then
@ -2010,7 +2010,7 @@ image_backend() {
*)
err "Image: Unknown image backend specified '$image_backend'."
err "Image: Valid backends are: 'ascii', 'caca', 'catimg', 'jp2a', 'iterm2', 'off', 'sixel', 'tycat', 'w3m')"
err "Image: Valid backends are: 'ascii', 'caca', 'catimg', 'jp2a', 'iterm2', 'off', 'sixel', 'termpix', 'tycat', 'w3m')"
err "Image: Falling back to ascii mode."
get_ascii
;;
@ -2398,6 +2398,10 @@ display_image() {
img2sixel -w "$width" "$image" || to_off "Image: libsixel failed to display the image."
;;
"termpix")
termpix --width "$((width / font_width))" "$image" || to_off "Image: termpix failed to display the image."
;;
"iterm2")
printf "%b\a\n" "\033]1337;File=width=${width}px;height=${height}px;inline=1:$(base64 < "$image")"
;;
@ -3813,6 +3817,7 @@ IMAGE BACKEND:
--iterm2 source Shortcut to use 'iterm2' backend.
--jp2a source Shortcut to use 'jp2a' backend.
--sixel source Shortcut to use 'sixel' backend.
--termpix source Shortcut to use 'termpix' backend.
--tycat source Shortcut to use 'tycat' backend.
--w3m source Shortcut to use 'w3m' backend.
--off Shortcut to use 'off' backend.
@ -4015,7 +4020,7 @@ get_args() {
# Image backend
"--backend") image_backend="$2" ;;
"--source") image_source="$2" ;;
"--ascii" | "--caca" | "--catimg" | "--jp2a" | "--iterm2" | "--off" | "--sixel" | "--tycat" | "--w3m")
"--ascii" | "--caca" | "--catimg" | "--jp2a" | "--iterm2" | "--off" | "--sixel" | "--termpix" | "--tycat" | "--w3m")
image_backend="${1/--}"
case "$2" in
"-"* | "") ;;
@ -4112,7 +4117,6 @@ main() {
printf "\033[?25l\033[?7l"
fi
# get_image_backend
image_backend
old_functions
get_cache_dir

View file

@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.3.
.TH NEOFETCH "1" "January 2017" "Neofetch 3.0.2" "User Commands"
.TH NEOFETCH "1" "February 2017" "Neofetch 3.0.2" "User Commands"
.SH NAME
Neofetch \- A fast, highly customizable system info script
.SH SYNOPSIS
@ -175,7 +175,7 @@ Possible values: bar, infobar, barinfo, off
.TP
\fB\-\-backend\fR backend
Which image backend to use.
Possible values: 'ascii', 'caca', 'catimg', 'jp2a', 'iterm2', 'off', 'tycat', 'w3m'
Possible values: 'ascii', 'caca', 'catimg', 'jp2a', 'iterm2', 'off', 'sixel', 'tycat', 'w3m'
.TP
\fB\-\-source\fR source
Which image or ascii file to use.
@ -196,6 +196,12 @@ Shortcut to use 'iterm2' backend.
\fB\-\-jp2a\fR source
Shortcut to use 'jp2a' backend.
.TP
\fB\-\-sixel\fR source
Shortcut to use 'sixel' backend.
.TP
\fB\-\-termpix\fR source
Shortcut to use 'termpix' backend.
.TP
\fB\-\-tycat\fR source
Shortcut to use 'tycat' backend.
.TP