image: Added pixterm backend.

This commit is contained in:
dylan araps 2017-12-16 15:51:07 +11:00
parent 8762403de9
commit 6711ebc91f
3 changed files with 21 additions and 8 deletions

View file

@ -543,7 +543,7 @@ disk_display="off"
# Image backend. # Image backend.
# #
# Default: 'ascii' # Default: 'ascii'
# Values: 'ascii', 'caca', 'catimg', 'jp2a', 'iterm2', 'off', 'tycat', 'w3m' # Values: 'ascii', 'caca', 'catimg', 'jp2a', 'iterm2', 'off', 'termpix', 'pixterm', 'tycat', 'w3m'
# Flag: --backend # Flag: --backend
image_backend="ascii" image_backend="ascii"

View file

@ -2374,7 +2374,8 @@ image_backend() {
"ascii") get_ascii ;; "ascii") get_ascii ;;
"off") image_backend="off" ;; "off") image_backend="off" ;;
"caca" | "catimg" | "jp2a" | "iterm2" | "termpix" | "tycat" | "w3m" | "sixel") "caca" | "catimg" | "jp2a" | "iterm2" | "termpix" |\
"tycat" | "w3m" | "sixel" | "pixterm")
get_image_source get_image_source
if [[ ! -f "$image" ]]; then if [[ ! -f "$image" ]]; then
@ -2400,7 +2401,7 @@ image_backend() {
*) *)
err "Image: Unknown image backend specified '$image_backend'." err "Image: Unknown image backend specified '$image_backend'."
err "Image: Valid backends are: 'ascii', 'caca', 'catimg', 'jp2a', 'iterm2', err "Image: Valid backends are: 'ascii', 'caca', 'catimg', 'jp2a', 'iterm2',
'off', 'sixel', 'termpix', 'tycat', 'w3m')" 'off', 'sixel', 'pixterm', 'termpix', 'tycat', 'w3m')"
err "Image: Falling back to ascii mode." err "Image: Falling back to ascii mode."
get_ascii get_ascii
;; ;;
@ -2800,8 +2801,16 @@ display_image() {
to_off "Image: jp2a failed to display the image." to_off "Image: jp2a failed to display the image."
;; ;;
"pixterm")
pixterm -tc "$((width / font_width))" \
-tr "$((height / font_height))" \
"$image" ||\
to_off "Image: pixterm failed to display the image."
;;
"sixel") "sixel")
img2sixel -w "$width" "$image" || to_off "Image: libsixel failed to display the image." img2sixel -w "$width" "$image" ||\
to_off "Image: libsixel failed to display the image."
;; ;;
"termpix") "termpix")
@ -4430,6 +4439,7 @@ IMAGE BACKEND:
--catimg source Shortcut to use 'catimg' backend. --catimg source Shortcut to use 'catimg' backend.
--iterm2 source Shortcut to use 'iterm2' backend. --iterm2 source Shortcut to use 'iterm2' backend.
--jp2a source Shortcut to use 'jp2a' backend. --jp2a source Shortcut to use 'jp2a' backend.
--pixterm source Shortcut to use 'pixterm' backend.
--sixel source Shortcut to use 'sixel' backend. --sixel source Shortcut to use 'sixel' backend.
--termpix source Shortcut to use 'termpix' backend. --termpix source Shortcut to use 'termpix' backend.
--tycat source Shortcut to use 'tycat' backend. --tycat source Shortcut to use 'tycat' backend.
@ -4645,8 +4655,8 @@ get_args() {
# Image backend # Image backend
"--backend") image_backend="$2" ;; "--backend") image_backend="$2" ;;
"--source") image_source="$2" ;; "--source") image_source="$2" ;;
"--ascii" | "--caca" | "--catimg" | "--jp2a" | "--iterm2" | "--off" | "--sixel" |\ "--ascii" | "--caca" | "--catimg" | "--jp2a" | "--iterm2" | "--off" | "--pixterm" |\
"--termpix" | "--tycat" | "--w3m") "--sixel" | "--termpix" | "--tycat" | "--w3m")
image_backend="${1/--}" image_backend="${1/--}"
case "$2" in case "$2" in
"-"* | "") ;; "-"* | "") ;;

View file

@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.4. .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.5.
.TH NEOFETCH "1" "September 2017" "Neofetch 3.3.0" "User Commands" .TH NEOFETCH "1" "December 2017" "Neofetch 3.3.1-git" "User Commands"
.SH NAME .SH NAME
Neofetch \- A fast, highly customizable system info script Neofetch \- A fast, highly customizable system info script
.SH SYNOPSIS .SH SYNOPSIS
@ -207,6 +207,9 @@ Shortcut to use 'iterm2' backend.
\fB\-\-jp2a\fR source \fB\-\-jp2a\fR source
Shortcut to use 'jp2a' backend. Shortcut to use 'jp2a' backend.
.TP .TP
\fB\-\-pixterm\fR source
Shortcut to use 'pixterm' backend.
.TP
\fB\-\-sixel\fR source \fB\-\-sixel\fR source
Shortcut to use 'sixel' backend. Shortcut to use 'sixel' backend.
.TP .TP