From 6711ebc91f9bea32a6c2c75b56324f35ca691925 Mon Sep 17 00:00:00 2001 From: dylan araps Date: Sat, 16 Dec 2017 15:51:07 +1100 Subject: [PATCH] image: Added pixterm backend. --- config/config.conf | 2 +- neofetch | 20 +++++++++++++++----- neofetch.1 | 7 +++++-- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/config/config.conf b/config/config.conf index f0d7cdb9..aadbf825 100644 --- a/config/config.conf +++ b/config/config.conf @@ -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" diff --git a/neofetch b/neofetch index 065a7ea6..a2c33551 100755 --- a/neofetch +++ b/neofetch @@ -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 "-"* | "") ;; diff --git a/neofetch.1 b/neofetch.1 index 160b9905..33958fb1 100644 --- a/neofetch.1 +++ b/neofetch.1 @@ -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