Merge pull request #616 from dylanaraps/image-rewrite
Image: Rewrite backend handling.
This commit is contained in:
commit
475dee93d8
129
config/config
129
config/config
|
@ -524,17 +524,69 @@ battery_display="off"
|
|||
disk_display="off"
|
||||
|
||||
|
||||
# Image Options
|
||||
# Backend Settings
|
||||
|
||||
# Image backend.
|
||||
#
|
||||
# Default: 'ascii'
|
||||
# Values: 'ascii', 'caca', 'catimg', 'jp2a', 'iterm2', 'off', 'tycat', 'w3m'
|
||||
# Flag: --backend
|
||||
image_backend="ascii"
|
||||
|
||||
# Image Source
|
||||
#
|
||||
# Default: 'ascii'
|
||||
# Values: 'ascii', 'wallpaper', '/path/to/img', '/path/to/dir/', 'off'
|
||||
# Flag: --image
|
||||
# Which image or ascii file to display.
|
||||
#
|
||||
# NOTE: Change this to 'wallpaper', '/path/to/img' or /path/to/dir/' to enable image mode. You can also launch neofetch with '--image wallpaper' and etc.
|
||||
image_source="ascii"
|
||||
# Default: 'auto'
|
||||
# Values: 'auto', 'ascii', 'wallpaper', '/path/to/img', '/path/to/ascii', '/path/to/dir/'
|
||||
# Flag: --source
|
||||
#
|
||||
# NOTE: 'auto' will pick the best image source for whatever image backend is used.
|
||||
# In ascii mode, distro ascii art will be used and in an image mode, your
|
||||
# wallpaper will be used.
|
||||
image_source="auto"
|
||||
|
||||
|
||||
# Ascii Options
|
||||
|
||||
|
||||
# Ascii distro
|
||||
# Which distro's ascii art to display.
|
||||
#
|
||||
# Default: 'auto'
|
||||
# Values: 'auto', 'distro_name'
|
||||
# Flag: --ascii_distro
|
||||
#
|
||||
# NOTE: Arch and Ubuntu have 'old' logo variants.
|
||||
# Change this to 'arch_old' or 'ubuntu_old' to use the old logos.
|
||||
# NOTE: Ubuntu has flavor variants.
|
||||
# Change this to 'Lubuntu', 'Xubuntu', 'Ubuntu-GNOME' or 'Ubuntu-Budgie' to use the flavors.
|
||||
# NOTE: Arch, Crux and Gentoo have a smaller logo variant.
|
||||
# Change this to 'arch_small', 'crux_small' or 'gentoo_small' to use the small logos.
|
||||
ascii_distro="auto"
|
||||
|
||||
# Ascii Colors
|
||||
#
|
||||
# Default: 'distro'
|
||||
# Values: 'distro', 'num' 'num' 'num' 'num' 'num' 'num'
|
||||
# Flag: --ascii_colors
|
||||
#
|
||||
# Example:
|
||||
# ascii_colors=(distro) - Ascii is colored based on Distro colors.
|
||||
# ascii_colors=(4 6 1 8 8 6) - Ascii is colored using these colors.
|
||||
ascii_colors=(distro)
|
||||
|
||||
# Bold ascii logo
|
||||
# Whether or not to bold the ascii logo.
|
||||
#
|
||||
# Default: 'on'
|
||||
# Values: 'on', 'off'
|
||||
# Flag: --ascii_bold
|
||||
ascii_bold="on"
|
||||
|
||||
|
||||
# Image Options
|
||||
|
||||
|
||||
# Thumbnail directory
|
||||
#
|
||||
|
@ -542,22 +594,6 @@ image_source="ascii"
|
|||
# Values: 'dir'
|
||||
thumbnail_dir="${XDG_CACHE_HOME:-${HOME}/.cache}/thumbnails/neofetch"
|
||||
|
||||
# w3m-img path
|
||||
# Only works with the w3m backend.
|
||||
#
|
||||
# NOTE: Only change this if "neofetch -v" says that it "couldn't find w3m-img".
|
||||
# Neofetch has a function that automatically finds w3m-img for you. It looks
|
||||
# in the following directories:
|
||||
# /usr/lib/w3m/w3mimgdisplay
|
||||
# /usr/libexec/w3m/w3mimgdisplay
|
||||
# /usr/lib64/w3m/w3mimgdisplay
|
||||
# /usr/libexec64/w3m/w3mimgdisplay
|
||||
# If w3m-img is installed elsewhere on your system, open an issue on the repo
|
||||
# and I'll add it to the function inside the script. If w3m-img is installed
|
||||
# in a non-standard way (in your home folder, etc) then change the variable
|
||||
# below to the custom location. Otherwise, don't touch this.
|
||||
w3m_img_path="/usr/lib/w3m/w3mimgdisplay"
|
||||
|
||||
# Crop mode
|
||||
#
|
||||
# Default: 'normal'
|
||||
|
@ -612,53 +648,6 @@ xoffset=0
|
|||
background_color=
|
||||
|
||||
|
||||
# Ascii Options
|
||||
|
||||
|
||||
# Default ascii image to use
|
||||
# When this is set to distro it will use your
|
||||
# distro's logo as the ascii.
|
||||
#
|
||||
# Default: 'distro'
|
||||
# Values: 'distro', '/path/to/ascii_file'
|
||||
# Flag: --ascii
|
||||
ascii="distro"
|
||||
|
||||
# Ascii distro
|
||||
# Which distro's ascii art to display.
|
||||
#
|
||||
# Default: 'auto'
|
||||
# Values: 'auto', 'distro_name'
|
||||
# Flag: --ascii_distro
|
||||
#
|
||||
# NOTE: Arch and Ubuntu have 'old' logo variants.
|
||||
# Change this to 'arch_old' or 'ubuntu_old' to use the old logos.
|
||||
# NOTE: Ubuntu has flavor variants.
|
||||
# Change this to 'Lubuntu', 'Xubuntu', 'Ubuntu-GNOME' or 'Ubuntu-Budgie' to use the flavors.
|
||||
# NOTE: Arch, Crux and Gentoo have a smaller logo variant.
|
||||
# Change this to 'arch_small', 'crux_small' or 'gentoo_small' to use the small logos.
|
||||
ascii_distro="auto"
|
||||
|
||||
# Ascii Colors
|
||||
#
|
||||
# Default: 'distro'
|
||||
# Values: 'distro', 'num' 'num' 'num' 'num' 'num' 'num'
|
||||
# Flag: --ascii_colors
|
||||
#
|
||||
# Example:
|
||||
# ascii_colors=(distro) - Ascii is colored based on Distro colors.
|
||||
# ascii_colors=(4 6 1 8 8 6) - Ascii is colored using these colors.
|
||||
ascii_colors=(distro)
|
||||
|
||||
# Bold ascii logo
|
||||
# Whether or not to bold the ascii logo.
|
||||
#
|
||||
# Default: 'on'
|
||||
# Values: 'on', 'off'
|
||||
# Flag: --ascii_bold
|
||||
ascii_bold="on"
|
||||
|
||||
|
||||
# Scrot Options
|
||||
|
||||
|
||||
|
@ -714,7 +703,7 @@ scrot_name="neofetch-$(date +%F-%I-%M-%S-${RANDOM}).png"
|
|||
image_host="teknik"
|
||||
|
||||
|
||||
# Config Options
|
||||
# Misc Options
|
||||
|
||||
|
||||
# Config version.
|
||||
|
|
291
neofetch
291
neofetch
|
@ -1948,78 +1948,62 @@ get_cols() {
|
|||
|
||||
# IMAGES
|
||||
|
||||
get_image_backend() {
|
||||
# This function determines which image backend to use
|
||||
# by checking for programs and etc.
|
||||
image_backend() {
|
||||
if [[ ! "$image_backend" =~ (off|ascii) ]]; then
|
||||
if ! type -p convert >/dev/null 2>&1; then
|
||||
image_backend="ascii"
|
||||
err "Image: Imagemagick not found, falling back to ascii mode."
|
||||
fi
|
||||
|
||||
# If the image source isn't "ascii" or "off".
|
||||
if [[ ! "${image_source}" =~ ^(off|ascii)$ ]]; then
|
||||
# If X isn't running force ascii mode here.
|
||||
[[ -z "$DISPLAY" ]] && image_source="ascii"
|
||||
|
||||
# Fallback to ascii mode if imagemagick isn't installed.
|
||||
type -p convert >/dev/null 2>&1 || image_source="ascii"
|
||||
[[ -z "$DISPLAY" ]] && image_backend="ascii"
|
||||
fi
|
||||
|
||||
# Get the image program.
|
||||
get_image_program
|
||||
case "${image_backend:-off}" in
|
||||
"ascii") get_ascii ;;
|
||||
"off") image_backend="off" ;;
|
||||
|
||||
# If image source is ascii fallback to ascii.
|
||||
if [[ "$image_source" == "ascii" ]]; then
|
||||
to_ascii "Image: \$image_source set to 'ascii', falling back to ascii mode."
|
||||
err "Image: Change \$image_source to another value to use image mode."
|
||||
return
|
||||
fi
|
||||
"caca" | "catimg" | "jp2a" | "iterm2" | "tycat" | "w3m")
|
||||
get_image_source
|
||||
|
||||
case "${image_backend:=image}" in
|
||||
"image")
|
||||
case "$image_source" in
|
||||
"wall"*) get_wallpaper 2>/dev/null ;;
|
||||
"off") image_backend="off"; return ;;
|
||||
*)
|
||||
if [[ -d "$image_source" ]]; then
|
||||
files=("${image_source%/}"/*.{png,jpg,jpeg})
|
||||
printf -v image "%s" "${files[RANDOM % (${#files[@]} - 1)]}"
|
||||
else
|
||||
image="$image_source"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# Fallback to ascii mode if image isn't a file.
|
||||
if [[ ! -f "$image" ]]; then
|
||||
to_ascii "Image: '$image' doesn't exist, falling back to ascii mode."
|
||||
to_ascii "Image: '$image_source' doesn't exist, falling back to ascii mode."
|
||||
return
|
||||
fi
|
||||
|
||||
get_term_size
|
||||
|
||||
# Fallback to ascii mode if terminal size wasn't found.
|
||||
if [[ -z "$term_width" ]] || ((term_width == 0)); then
|
||||
to_ascii "Image: Failed to find terminal window size"
|
||||
err "Image: Check the 'Images in the terminal' wiki page for more info"
|
||||
if [[ "$term_width" ]] && ((term_width >= 1)); then
|
||||
clear
|
||||
zws=" "
|
||||
else
|
||||
unset image_program
|
||||
to_ascii "Image: Failed to find terminal window size."
|
||||
err "Image: Check the 'Images in the terminal' wiki page for more info,"
|
||||
return
|
||||
fi
|
||||
|
||||
get_image_size
|
||||
make_thumbnail
|
||||
|
||||
# If the backend is still set to "image" after
|
||||
# make_thumbnail(), then display the image.
|
||||
[[ "$image_backend" == "image" ]] && display_image
|
||||
display_image 2>/dev/null
|
||||
;;
|
||||
|
||||
"ascii") get_ascii 2>/dev/null ;;
|
||||
*)
|
||||
err "Image: Unknown image backend specified '$image_backend'."
|
||||
err "Image: Valid backends are: 'ascii', 'caca', 'catimg', 'jp2a', 'iterm2', 'off', 'tycat', 'w3m')"
|
||||
err "Image: Falling back to ascii mode."
|
||||
get_ascii
|
||||
;;
|
||||
esac
|
||||
|
||||
# Set cursor position next to ascii art.
|
||||
# Set cursor position next image/ascii.
|
||||
[[ "$image_backend" != "off" ]] && printf "%b" "\033[${lines:-0}A\033[9999999D"
|
||||
}
|
||||
|
||||
get_ascii() {
|
||||
if [[ ! -f "$ascii" || "$ascii" == "distro" ]]; then
|
||||
if [[ ! -f "$image_source" || "$image_source" =~ (auto|ascii) ]]; then
|
||||
# Fallback to distro ascii mode if custom ascii isn't found.
|
||||
[[ "$ascii" != "distro" && ! -f "$ascii" ]] && \
|
||||
[[ ! "$image_source" =~ (auto|ascii) ]] && \
|
||||
err "Ascii: Ascii file not found, using distro ascii."
|
||||
|
||||
if [[ -d "/usr/share/neofetch/ascii/distro" ]]; then
|
||||
|
@ -2036,10 +2020,10 @@ get_ascii() {
|
|||
ascii_dir="${script_dir}/ascii/distro"
|
||||
fi
|
||||
|
||||
ascii="${ascii_dir}/${ascii_file}"
|
||||
image_source="${ascii_dir}/${ascii_file}"
|
||||
|
||||
# Fallback to no ascii mode if distro ascii isn't found.
|
||||
[[ ! -f "$ascii" ]] && \
|
||||
[[ ! -f "$image_source" ]] && \
|
||||
{ to_off "Ascii: Failed to find distro ascii, falling back to no ascii mode."; return; }
|
||||
fi
|
||||
|
||||
|
@ -2055,7 +2039,7 @@ get_ascii() {
|
|||
line="${line//\\\\/\\}"
|
||||
((${#line} > ascii_length)) && ascii_length="${#line}"
|
||||
((++lines))
|
||||
done < "$ascii"
|
||||
done < "$image_source"
|
||||
|
||||
# Colors.
|
||||
print="${print//'${c1}'/$c1}"
|
||||
|
@ -2073,39 +2057,26 @@ get_ascii() {
|
|||
export LC_ALL=C
|
||||
}
|
||||
|
||||
get_image_program() {
|
||||
if [[ -n "$ITERM_PROFILE" ]]; then
|
||||
image_program="iterm2"
|
||||
get_image_source() {
|
||||
case "$image_source" in
|
||||
"auto" | "wall"*)
|
||||
get_wallpaper 2>/dev/null
|
||||
;;
|
||||
|
||||
elif [[ "$(tycat 2>/dev/null)" ]]; then
|
||||
image_program="tycat"
|
||||
*)
|
||||
if [[ -d "$image_source" ]]; then
|
||||
shopt -s nullglob
|
||||
files=("${image_source%/}"/*.{png,jpg,jpeg,jpe,gif})
|
||||
shopt -u nullglob
|
||||
image="${files[RANDOM % ${#files[@]}]}"
|
||||
|
||||
else
|
||||
image_program="w3m"
|
||||
get_w3m_img_path
|
||||
fi
|
||||
}
|
||||
else
|
||||
image="$image_source"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
get_w3m_img_path() {
|
||||
if [[ -x "$w3m_img_path" ]]; then
|
||||
return
|
||||
|
||||
elif [[ -x "/usr/lib/w3m/w3mimgdisplay" ]]; then
|
||||
w3m_img_path="/usr/lib/w3m/w3mimgdisplay"
|
||||
|
||||
elif [[ -x "/usr/libexec/w3m/w3mimgdisplay" ]]; then
|
||||
w3m_img_path="/usr/libexec/w3m/w3mimgdisplay"
|
||||
|
||||
elif [[ -x "/usr/lib64/w3m/w3mimgdisplay" ]]; then
|
||||
w3m_img_path="/usr/lib64/w3m/w3mimgdisplay"
|
||||
|
||||
elif [[ -x "/usr/libexec64/w3m/w3mimgdisplay" ]]; then
|
||||
w3m_img_path="/usr/libexec64/w3m/w3mimgdisplay"
|
||||
|
||||
else
|
||||
image_backend="ascii"
|
||||
err "Image: w3m-img wasn't found on your system, falling back to ascii mode."
|
||||
fi
|
||||
err "Image: Using image $image"
|
||||
}
|
||||
|
||||
get_wallpaper() {
|
||||
|
@ -2169,6 +2140,25 @@ get_wallpaper() {
|
|||
[[ "${image/*\./}" == "xml" ]] && image=""
|
||||
}
|
||||
|
||||
get_w3m_img_path() {
|
||||
# Find w3m-img path.
|
||||
if [[ -x "/usr/lib/w3m/w3mimgdisplay" ]]; then
|
||||
w3m_img_path="/usr/lib/w3m/w3mimgdisplay"
|
||||
|
||||
elif [[ -x "/usr/libexec/w3m/w3mimgdisplay" ]]; then
|
||||
w3m_img_path="/usr/libexec/w3m/w3mimgdisplay"
|
||||
|
||||
elif [[ -x "/usr/lib64/w3m/w3mimgdisplay" ]]; then
|
||||
w3m_img_path="/usr/lib64/w3m/w3mimgdisplay"
|
||||
|
||||
elif [[ -x "/usr/libexec64/w3m/w3mimgdisplay" ]]; then
|
||||
w3m_img_path="/usr/libexec64/w3m/w3mimgdisplay"
|
||||
|
||||
else
|
||||
err "Image: w3m-img wasn't found on your system"
|
||||
fi
|
||||
}
|
||||
|
||||
get_term_size() {
|
||||
# This functions gets the current window size in
|
||||
# pixels.
|
||||
|
@ -2237,12 +2227,6 @@ get_term_size() {
|
|||
term_width=0
|
||||
fi
|
||||
fi
|
||||
|
||||
# If the terminal size was found correctly.
|
||||
if [[ "$term_width" ]] && ((term_width >= 1)); then
|
||||
clear
|
||||
zws=" "
|
||||
fi
|
||||
}
|
||||
|
||||
get_image_size() {
|
||||
|
@ -2364,13 +2348,20 @@ make_thumbnail() {
|
|||
}
|
||||
|
||||
display_image() {
|
||||
case "$image_program" in
|
||||
"w3m")
|
||||
# Add a tiny delay to fix issues with images not
|
||||
# appearing in specific terminal emulators.
|
||||
sleep 0.05
|
||||
printf "%b\n" "0;1;$xoffset;$yoffset;$width;$height;;;;;$image\n4;\n3;" |\
|
||||
"$w3m_img_path" -bg "$background_color" >/dev/null & 2>&1 || to_off "Images: w3m-img failed to display the image."
|
||||
case "$image_backend" in
|
||||
"caca")
|
||||
img2txt -W "$((width / font_width)))" -H "$((height / font_height))" --gamma=0.6 "$image" || to_off "Image: catimg failed to display the image."
|
||||
zws=
|
||||
;;
|
||||
|
||||
"catimg")
|
||||
catimg -w "$((width * 2 / font_width))" -r 0 "$image" || to_off "Image: catimg failed to display the image."
|
||||
zws=
|
||||
;;
|
||||
|
||||
"jp2a")
|
||||
jp2a --width="$((width / font_width))" --colors "$image" || to_off "Image: jp2a failed to display the image."
|
||||
zws=
|
||||
;;
|
||||
|
||||
"iterm2")
|
||||
|
@ -2378,31 +2369,41 @@ display_image() {
|
|||
;;
|
||||
|
||||
"tycat")
|
||||
tycat "$image" || to_off "Images: tycat failed to display the image."
|
||||
tycat "$image" || to_off "Image: tycat failed to display the image."
|
||||
;;
|
||||
|
||||
"w3m")
|
||||
get_w3m_img_path
|
||||
|
||||
# Add a tiny delay to fix issues with images not
|
||||
# appearing in specific terminal emulators.
|
||||
sleep 0.05
|
||||
printf "%b\n" "0;1;$xoffset;$yoffset;$width;$height;;;;;$image\n4;\n3;" |\
|
||||
"${w3m_img_path:-false}" -bg "$background_color" >/dev/null & 2>&1 || to_off "Image: w3m-img failed to display the image."
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
to_ascii() {
|
||||
# Log the error.
|
||||
err "$1"
|
||||
|
||||
# This function makes neofetch fallback to ascii mode.
|
||||
image_backend="ascii"
|
||||
|
||||
# Print the ascii art.
|
||||
get_ascii 2>/dev/null
|
||||
|
||||
# Move cursor next to ascii art.
|
||||
# Set cursor position next image/ascii.
|
||||
printf "%b" "\033[${lines:-0}A\033[9999999D"
|
||||
|
||||
# Log the error.
|
||||
err "$1"
|
||||
}
|
||||
|
||||
to_off() {
|
||||
# This function makes neofetch fallback to off mode.
|
||||
err "$1"
|
||||
image_backend="off"
|
||||
text_padding=
|
||||
zws=
|
||||
err "$1"
|
||||
}
|
||||
|
||||
# SCREENSHOT
|
||||
|
@ -2555,7 +2556,7 @@ get_underline() {
|
|||
|
||||
get_line_break() {
|
||||
# Print it directly.
|
||||
printf "%s\n" "${zws} "
|
||||
printf "%s\n" "${zws}"
|
||||
|
||||
# Calculate info height.
|
||||
((++info_height))
|
||||
|
@ -3411,13 +3412,14 @@ get_term_padding() {
|
|||
|
||||
dynamic_prompt() {
|
||||
case "$image_backend" in
|
||||
"image")
|
||||
"ascii") ;;
|
||||
"off") return ;;
|
||||
*)
|
||||
get_term_padding 2>/dev/null
|
||||
|
||||
# Calculate image height in terminal cells.
|
||||
lines="$(((border * 2 + height + yoffset) / font_height))"
|
||||
;;
|
||||
"off") return ;;
|
||||
esac
|
||||
|
||||
# If the info is higher than the ascii/image place the prompt
|
||||
|
@ -3714,33 +3716,23 @@ BARS:
|
|||
Possible values: bar, infobar, barinfo, off
|
||||
--disk_display mode Bar mode.
|
||||
Possible values: bar, infobar, barinfo, off
|
||||
IMAGE:
|
||||
--image type Image source. Where and what image we display.
|
||||
Possible values: wall, ascii,
|
||||
/path/to/img, /path/to/dir/, off
|
||||
--size 00px | --size 00% How to size the image.
|
||||
Possible values: auto, 00px, 00%, none
|
||||
--crop_mode mode Which crop mode to use
|
||||
Possible values: normal, fit, fill
|
||||
--crop_offset value Change the crop offset for normal mode.
|
||||
Possible values: northwest, north, northeast,
|
||||
west, center, east, southwest, south, southeast
|
||||
|
||||
--xoffset px How close the image will be to the left edge of the
|
||||
window. This only works with w3m.
|
||||
--yoffset px How close the image will be to the top edge of the
|
||||
window. This only works with w3m.
|
||||
--bg_color color Background color to display behind transparent image.
|
||||
This only works with w3m.
|
||||
--gap num Gap between image and text.
|
||||
IMAGE BACKEND:
|
||||
--backend backend Which image backend to use.
|
||||
Possible values: 'ascii', 'caca', 'catimg', 'jp2a', 'iterm2', 'off', 'tycat', 'w3m'
|
||||
--source source Which image or ascii file to use.
|
||||
Possible values: 'auto', 'ascii', 'wallpaper', '/path/to/img', '/path/to/ascii', '/path/to/dir/'
|
||||
--ascii source Shortcut to use 'ascii' backend.
|
||||
--caca source Shortcut to use 'caca' backend.
|
||||
--catimg source Shortcut to use 'catimg' backend.
|
||||
--iterm2 source Shortcut to use 'iterm2' backend.
|
||||
--tycat source Shortcut to use 'tycat' backend.
|
||||
--w3m source Shortcut to use 'w3m' backend.
|
||||
--off Shortcut to use 'off' backend.
|
||||
|
||||
NOTE: --gap can take a negative value which will move the text closer to the left side.
|
||||
|
||||
--clean Delete cached files and thumbnails.
|
||||
NOTE: 'source; can be any of the following: 'auto', 'ascii', 'wallpaper', '/path/to/img', '/path/to/ascii', '/path/to/dir/'
|
||||
|
||||
ASCII:
|
||||
--ascii value Where to get the ascii from, Possible values:
|
||||
distro, /path/to/ascii
|
||||
--ascii_colors x x x x x x Colors to print the ascii art
|
||||
--ascii_distro distro Which Distro's ascii art to print
|
||||
|
||||
|
@ -3759,6 +3751,29 @@ ASCII:
|
|||
--ascii_bold on/off Whether or not to bold the ascii logo.
|
||||
-L, --logo Hide the info text and only show the ascii logo.
|
||||
|
||||
Possible values: bar, infobar, barinfo, off
|
||||
|
||||
IMAGE:
|
||||
--size 00px | --size 00% How to size the image.
|
||||
Possible values: auto, 00px, 00%, none
|
||||
--crop_mode mode Which crop mode to use
|
||||
Takes the values: normal, fit, fill
|
||||
--crop_offset value Change the crop offset for normal mode.
|
||||
Possible values: northwest, north, northeast,
|
||||
west, center, east, southwest, south, southeast
|
||||
|
||||
--xoffset px How close the image will be to the left edge of the
|
||||
window. This only works with w3m.
|
||||
--yoffset px How close the image will be to the top edge of the
|
||||
window. This only works with w3m.
|
||||
--bg_color color Background color to display behind transparent image.
|
||||
This only works with w3m.
|
||||
--gap num Gap between image and text.
|
||||
|
||||
NOTE: --gap can take a negative value which will move the text closer to the left side.
|
||||
|
||||
--clean Delete cached files and thumbnails.
|
||||
|
||||
SCREENSHOT:
|
||||
-s, --scrot /path/to/img Take a screenshot, if path is left empty the screen-
|
||||
shot function will use \$scrot_dir and \$scrot_name.
|
||||
|
@ -3814,7 +3829,7 @@ exit 1
|
|||
|
||||
get_args() {
|
||||
# Check the commandline flags early for '--config'.
|
||||
[[ "$@" =~ --config ]] || get_user_config 2>/dev/null
|
||||
[[ "$@" != *--config* ]] && get_user_config 2>/dev/null
|
||||
|
||||
while [[ "$1" ]]; do
|
||||
case "$1" in
|
||||
|
@ -3910,12 +3925,18 @@ get_args() {
|
|||
"--battery_display") battery_display="$2" ;;
|
||||
"--disk_display") disk_display="$2" ;;
|
||||
|
||||
# Image
|
||||
"--image")
|
||||
image_source="$2"
|
||||
case "$2" in "-"* | "" | "ascii") image_backend="ascii" ;; esac
|
||||
# Image backend
|
||||
"--backend") image_backend="$2" ;;
|
||||
"--source") image_source="$2" ;;
|
||||
"--ascii" | "--caca" | "--catimg" | "--jp2a" | "--iterm2" | "--off" | "--tycat" | "--w3m")
|
||||
image_backend="${1/--}"
|
||||
case "$2" in
|
||||
"-"* | "") ;;
|
||||
*) image_source="$2" ;;
|
||||
esac
|
||||
;;
|
||||
|
||||
# Image options
|
||||
"--image_size" | "--size") image_size="$2" ;;
|
||||
"--crop_mode") crop_mode="$2" ;;
|
||||
"--crop_offset") crop_offset="$2" ;;
|
||||
|
@ -3930,13 +3951,6 @@ get_args() {
|
|||
exit
|
||||
;;
|
||||
|
||||
# Ascii
|
||||
"--ascii")
|
||||
image_backend="ascii"
|
||||
ascii="$2"
|
||||
case "$2" in "-"* | "") ascii="distro" ;; esac
|
||||
;;
|
||||
|
||||
"--ascii_colors")
|
||||
unset ascii_colors
|
||||
for arg in "$2" "$3" "$4" "$5" "$6" "$7"; do
|
||||
|
@ -4008,7 +4022,8 @@ main() {
|
|||
printf "\033[?25l\033[?7l"
|
||||
fi
|
||||
|
||||
get_image_backend
|
||||
# get_image_backend
|
||||
image_backend
|
||||
old_functions
|
||||
get_cache_dir
|
||||
print_info 2>/dev/null
|
||||
|
@ -4016,7 +4031,7 @@ main() {
|
|||
|
||||
# w3m-img: Draw the image a second time to fix
|
||||
# rendering issues in specific terminal emulators.
|
||||
[[ "$image_backend" == "image" && "$image_program" == "w3m" ]] && display_image
|
||||
[[ "$image_program" == *w3m* ]] && display_image 2>/dev/null
|
||||
|
||||
# Take a screenshot.
|
||||
[[ "$scrot" == "on" ]] && take_scrot
|
||||
|
|
95
neofetch.1
95
neofetch.1
|
@ -171,12 +171,66 @@ Possible values: bar, infobar, barinfo, off
|
|||
\fB\-\-disk_display\fR mode
|
||||
Bar mode.
|
||||
Possible values: bar, infobar, barinfo, off
|
||||
.SS "IMAGE:"
|
||||
.SS "IMAGE BACKEND:"
|
||||
.TP
|
||||
\fB\-\-image\fR type
|
||||
Image source. Where and what image we display.
|
||||
Possible values: wall, ascii,
|
||||
\fI\,/path/to/img\/\fP, /path/to/dir/, off
|
||||
\fB\-\-backend\fR backend
|
||||
Which image backend to use.
|
||||
Possible values: 'ascii', 'caca', 'catimg', 'jp2a', 'iterm2', 'off', 'tycat', 'w3m'
|
||||
.TP
|
||||
\fB\-\-source\fR source
|
||||
Which image or ascii file to use.
|
||||
Possible values: 'auto', 'ascii', 'wallpaper', '/path/to/img', '/path/to/ascii', '/path/to/dir/'
|
||||
.TP
|
||||
\fB\-\-ascii\fR
|
||||
source Shortcut to use 'ascii' backend.
|
||||
.TP
|
||||
\fB\-\-caca\fR
|
||||
source Shortcut to use 'caca' backend.
|
||||
.TP
|
||||
\fB\-\-catimg\fR
|
||||
source Shortcut to use 'catimg' backend.
|
||||
.TP
|
||||
\fB\-\-iterm2\fR
|
||||
source Shortcut to use 'iterm2' backend.
|
||||
.TP
|
||||
\fB\-\-tycat\fR
|
||||
source Shortcut to use 'tycat' backend.
|
||||
.TP
|
||||
\fB\-\-w3m\fR
|
||||
source Shortcut to use 'w3m' backend.
|
||||
.TP
|
||||
\fB\-\-off\fR
|
||||
Shortcut to use 'off' backend.
|
||||
.IP
|
||||
NOTE: 'source; can be any of the following: 'auto', 'ascii', 'wallpaper', '/path/to/img', '/path/to/ascii', '/path/to/dir/'
|
||||
.SS "ASCII:"
|
||||
.TP
|
||||
\fB\-\-ascii_colors\fR x x x x x x
|
||||
Colors to print the ascii art
|
||||
.TP
|
||||
\fB\-\-ascii_distro\fR distro
|
||||
Which Distro's ascii art to print
|
||||
.IP
|
||||
NOTE: Arch and Ubuntu have 'old' logo variants.
|
||||
.IP
|
||||
NOTE: Use 'arch_old' or 'ubuntu_old' to use the old logos.
|
||||
.IP
|
||||
NOTE: Ubuntu has flavor variants.
|
||||
.IP
|
||||
NOTE: Change this to 'Lubuntu', 'Xubuntu', 'Ubuntu\-GNOME', 'Ubuntu\-Studio' or 'Ubuntu\-Budgie' to use the flavors.
|
||||
.IP
|
||||
NOTE: Alpine, Arch, Crux, Gentoo, OpenBSD, and Void have a smaller logo variant.
|
||||
.IP
|
||||
NOTE: Change this to 'alpine_small', 'arch_small', 'crux_small', 'gentoo_small', 'openbsd_small', and 'void_small' to use the small logos.
|
||||
.TP
|
||||
\fB\-\-ascii_bold\fR on/off
|
||||
Whether or not to bold the ascii logo.
|
||||
.TP
|
||||
\fB\-L\fR, \fB\-\-logo\fR
|
||||
Hide the info text and only show the ascii logo.
|
||||
.IP
|
||||
Possible values: bar, infobar, barinfo, off
|
||||
.SS "IMAGE:"
|
||||
.TP
|
||||
\fB\-\-size\fR 00px | \fB\-\-size\fR 00%
|
||||
How to size the image.
|
||||
|
@ -184,7 +238,7 @@ Possible values: auto, 00px, 00%, none
|
|||
.TP
|
||||
\fB\-\-crop_mode\fR mode
|
||||
Which crop mode to use
|
||||
Possible values: normal, fit, fill
|
||||
Takes the values: normal, fit, fill
|
||||
.TP
|
||||
\fB\-\-crop_offset\fR value
|
||||
Change the crop offset for normal mode.
|
||||
|
@ -210,35 +264,6 @@ NOTE: \fB\-\-gap\fR can take a negative value which will move the text closer to
|
|||
.TP
|
||||
\fB\-\-clean\fR
|
||||
Delete cached files and thumbnails.
|
||||
.SS "ASCII:"
|
||||
.TP
|
||||
\fB\-\-ascii\fR value
|
||||
Where to get the ascii from, Possible values:
|
||||
distro, \fI\,/path/to/ascii\/\fP
|
||||
.TP
|
||||
\fB\-\-ascii_colors\fR x x x x x x
|
||||
Colors to print the ascii art
|
||||
.TP
|
||||
\fB\-\-ascii_distro\fR distro
|
||||
Which Distro's ascii art to print
|
||||
.IP
|
||||
NOTE: Arch and Ubuntu have 'old' logo variants.
|
||||
.IP
|
||||
NOTE: Use 'arch_old' or 'ubuntu_old' to use the old logos.
|
||||
.IP
|
||||
NOTE: Ubuntu has flavor variants.
|
||||
.IP
|
||||
NOTE: Change this to 'Lubuntu', 'Xubuntu', 'Ubuntu\-GNOME', 'Ubuntu\-Studio' or 'Ubuntu\-Budgie' to use the flavors.
|
||||
.IP
|
||||
NOTE: Alpine, Arch, Crux, Gentoo, OpenBSD, and Void have a smaller logo variant.
|
||||
.IP
|
||||
NOTE: Change this to 'alpine_small', 'arch_small', 'crux_small', 'gentoo_small', 'openbsd_small', and 'void_small' to use the small logos.
|
||||
.TP
|
||||
\fB\-\-ascii_bold\fR on/off
|
||||
Whether or not to bold the ascii logo.
|
||||
.TP
|
||||
\fB\-L\fR, \fB\-\-logo\fR
|
||||
Hide the info text and only show the ascii logo.
|
||||
.SS "SCREENSHOT:"
|
||||
.TP
|
||||
\fB\-s\fR, \fB\-\-scrot\fR \fI\,/path/to/img\/\fP
|
||||
|
|
Reference in New Issue