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.
#
# Default: 'ascii'
# Values: 'ascii', 'caca', 'catimg', 'jp2a', 'iterm2', 'off', 'tycat', 'w3m'
# Values: 'ascii', 'caca', 'catimg', 'jp2a', 'iterm2', 'off', 'termpix', 'pixterm', 'tycat', 'w3m'
# Flag: --backend
image_backend="ascii"

View File

@ -2374,7 +2374,8 @@ image_backend() {
"ascii") get_ascii ;;
"off") image_backend="off" ;;
"caca" | "catimg" | "jp2a" | "iterm2" | "termpix" | "tycat" | "w3m" | "sixel")
"caca" | "catimg" | "jp2a" | "iterm2" | "termpix" |\
"tycat" | "w3m" | "sixel" | "pixterm")
get_image_source
if [[ ! -f "$image" ]]; then
@ -2400,7 +2401,7 @@ image_backend() {
*)
err "Image: Unknown image backend specified '$image_backend'."
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."
get_ascii
;;
@ -2800,8 +2801,16 @@ display_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")
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")
@ -4430,6 +4439,7 @@ IMAGE BACKEND:
--catimg source Shortcut to use 'catimg' backend.
--iterm2 source Shortcut to use 'iterm2' backend.
--jp2a source Shortcut to use 'jp2a' backend.
--pixterm source Shortcut to use 'pixterm' backend.
--sixel source Shortcut to use 'sixel' backend.
--termpix source Shortcut to use 'termpix' backend.
--tycat source Shortcut to use 'tycat' backend.
@ -4645,8 +4655,8 @@ get_args() {
# Image backend
"--backend") image_backend="$2" ;;
"--source") image_source="$2" ;;
"--ascii" | "--caca" | "--catimg" | "--jp2a" | "--iterm2" | "--off" | "--sixel" |\
"--termpix" | "--tycat" | "--w3m")
"--ascii" | "--caca" | "--catimg" | "--jp2a" | "--iterm2" | "--off" | "--pixterm" |\
"--sixel" | "--termpix" | "--tycat" | "--w3m")
image_backend="${1/--}"
case "$2" in
"-"* | "") ;;

View File

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