Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

feat(backend): add viu image backend #1592

Merged
merged 2 commits into from
Nov 3, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions neofetch
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,8 @@ disk_display="off"
#
# Default: 'ascii'
# Values: 'ascii', 'caca', 'catimg', 'chafa', 'jp2a', 'iterm2', 'off',
# 'pot', 'termpix', 'pixterm', 'tycat', 'w3m', 'kitty', 'ueberzug'
# 'pot', 'termpix', 'pixterm', 'tycat', 'w3m', 'kitty', 'ueberzug',
# 'viu'

# Flag: --backend
image_backend="ascii"
Expand Down Expand Up @@ -3892,7 +3893,8 @@ image_backend() {
"off") image_backend="off" ;;

"caca" | "catimg" | "chafa" | "jp2a" | "iterm2" | "termpix" |\
"tycat" | "w3m" | "sixel" | "pixterm" | "kitty" | "pot", | "ueberzug")
"tycat" | "w3m" | "sixel" | "pixterm" | "kitty" | "pot", | "ueberzug" |\
"viu")
get_image_source

[[ ! -f "$image" ]] && {
Expand All @@ -3919,7 +3921,7 @@ image_backend() {
err "Image: Unknown image backend specified '$image_backend'."
err "Image: Valid backends are: 'ascii', 'caca', 'catimg', 'chafa', 'jp2a', 'iterm2',
'kitty', 'off', 'sixel', 'pot', 'pixterm', 'termpix',
'tycat', 'w3m')"
'tycat', 'w3m', 'viu')"
err "Image: Falling back to ascii mode."
print_ascii
;;
Expand Down Expand Up @@ -4398,6 +4400,12 @@ display_image() {
"$image"
;;

"viu")
viu \
-t -w ""$((width / font_width))"" -h "$((height / font_height))" \
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

""$((width / font_width))"" should be "$((width / font_width))"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

"$image"
;;

"w3m")
get_w3m_img_path
zws='\xE2\x80\x8B\x20'
Expand Down Expand Up @@ -4973,7 +4981,7 @@ BARS:
IMAGE BACKEND:
--backend backend Which image backend to use.
Possible values: 'ascii', 'caca', 'catimg', 'chafa', 'jp2a',
'iterm2', 'off', 'sixel', 'tycat', 'w3m', 'kitty'
'iterm2', 'off', 'sixel', 'tycat', 'w3m', 'kitty', 'viu'
--source source Which image or ascii file to use.
Possible values: 'auto', 'ascii', 'wallpaper', '/path/to/img',
'/path/to/ascii', '/path/to/dir/', 'command output' [ascii]
Expand All @@ -4995,6 +5003,7 @@ IMAGE BACKEND:
--tycat source Shortcut to use 'tycat' backend.
--w3m source Shortcut to use 'w3m' backend.
--ueberzug source Shortcut to use 'ueberzug' backend
--viu source Shortcut to use 'viu' backend
--off Shortcut to use 'off' backend (Disable ascii art).

NOTE: 'source; can be any of the following: 'auto', 'ascii', 'wallpaper', '/path/to/img',
Expand Down Expand Up @@ -5224,7 +5233,7 @@ get_args() {
"--source") image_source="$2" ;;
"--ascii" | "--caca" | "--catimg" | "--chafa" | "--jp2a" | "--iterm2" | "--off" |\
"--pot" | "--pixterm" | "--sixel" | "--termpix" | "--tycat" | "--w3m" | "--kitty" |\
"--ueberzug")
"--ueberzug" | "--viu")
image_backend="${1/--}"
case $2 in
"-"* | "") ;;
Expand Down