From 2606e4b1d6c431efc2a9bea4f0bec2385ad805f2 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Fri, 20 Apr 2018 07:48:41 +1000 Subject: [PATCH] image: Added kitty backend. Closes #953 --- neofetch | 12 +++++++++--- neofetch.1 | 27 +++------------------------ 2 files changed, 12 insertions(+), 27 deletions(-) diff --git a/neofetch b/neofetch index e97281e7..c54e99d5 100755 --- a/neofetch +++ b/neofetch @@ -2629,7 +2629,7 @@ image_backend() { "off") image_backend="off" ;; "caca" | "catimg" | "jp2a" | "iterm2" | "termpix" |\ - "tycat" | "w3m" | "sixel" | "pixterm") + "tycat" | "w3m" | "sixel" | "pixterm" | "kitty") get_image_source if [[ ! -f "$image" ]]; then @@ -2654,7 +2654,7 @@ 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', 'kitty', 'off', 'sixel', 'pixterm', 'termpix', 'tycat', 'w3m')" err "Image: Falling back to ascii mode." get_ascii @@ -3066,6 +3066,11 @@ display_image() { to_off "Image: jp2a failed to display the image." ;; + "kitty") + kitty icat --align left --place "${width}x${height}@${xoffset}x${yoffset}" "$image" ||\ + to_off "Image: kitty failed to display the image." + ;; + "pixterm") pixterm -tc "$((width / font_width))" \ -tr "$((height / font_height))" \ @@ -4762,6 +4767,7 @@ IMAGE BACKEND: --catimg source Shortcut to use 'catimg' backend. --iterm2 source Shortcut to use 'iterm2' backend. --jp2a source Shortcut to use 'jp2a' backend. + --kitty source Shortcut to use 'kitty' backend. --pixterm source Shortcut to use 'pixterm' backend. --sixel source Shortcut to use 'sixel' backend. --termpix source Shortcut to use 'termpix' backend. @@ -4949,7 +4955,7 @@ get_args() { "--backend") image_backend="$2" ;; "--source") image_source="$2" ;; "--ascii" | "--caca" | "--catimg" | "--jp2a" | "--iterm2" | "--off" | "--pixterm" |\ - "--sixel" | "--termpix" | "--tycat" | "--w3m") + "--sixel" | "--termpix" | "--tycat" | "--w3m" | "--kitty") image_backend="${1/--}" case "$2" in "-"* | "") ;; diff --git a/neofetch.1 b/neofetch.1 index 51d4cec4..d43db1d8 100644 --- a/neofetch.1 +++ b/neofetch.1 @@ -211,6 +211,9 @@ Shortcut to use 'iterm2' backend. \fB\-\-jp2a\fR source Shortcut to use 'jp2a' backend. .TP +\fB\-\-kitty\fR source +Shortcut to use 'kitty' backend. +.TP \fB\-\-pixterm\fR source Shortcut to use 'pixterm' backend. .TP @@ -338,29 +341,5 @@ Display a verbose log for error reporting. .TP \fB\-\-gen\-man\fR Generate a manpage for Neofetch in your PWD. (Requires GNU help2man) -.SH AUTHOR -Written by Dylan Araps with help from the following people: -.PP -https://github.com/dylanaraps/neofetch/contributors .SH "REPORTING BUGS" Report bugs to https://github.com/dylanaraps/neofetch/issues -.SH COPYRIGHT -Copyright \(co 2016\-2017 Dylan Araps -.PP -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the 'Software'), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: -.PP -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. -.PP -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE.