General: Fix more bugs

This commit is contained in:
Dylan Araps 2017-01-14 21:49:32 +11:00
parent 68f8998544
commit cb68028310
2 changed files with 39 additions and 38 deletions

View File

@ -526,15 +526,26 @@ disk_display="off"
# Image Options
# Image backend.
#
# Default: 'ascii'
# Values: 'ascii', 'w3m', 'iterm2', 'tycat', 'off'
# Flag: --image_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: --image_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"
# Thumbnail directory
#
@ -542,22 +553,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'
@ -615,15 +610,6 @@ 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.
#
@ -716,6 +702,21 @@ image_host="teknik"
# Config Options
# 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"
# Enable/Disable config file
#

View File

@ -1947,14 +1947,14 @@ image_backend() {
type -p convert >/dev/null 2>&1 || image_backend="ascii"
# If X isn't running force ascii mode here.
[[ -z "$DISPLAY" ]] && image_source="ascii"
[[ -z "$DISPLAY" ]] && image_backend="ascii"
fi
case "${image_backend:-off}" in
"ascii") get_ascii ;;
"off") image_backend="off" ;;
"iterm2" | "w3m-img" | "tycat")
"iterm2" | "w3m" | "tycat")
get_image_source
if [[ ! -f "$image" ]]; then
@ -1991,7 +1991,7 @@ image_backend() {
*)
image_backend="off"
err "Image: Unknown image backend specified. ($image_backend)"
err "Image: Valid backends are: 'iterm2', 'w3m-img'. 'tycat', 'ascii', 'off'"
err "Image: Valid backends are: 'iterm2', 'w3m'. 'tycat', 'ascii', 'off'"
err "Image: Falling back to off mode."
;;
esac
@ -2001,9 +2001,9 @@ image_backend() {
}
get_ascii() {
if [[ ! -f "$image_source" || "$image_source" == "distro" ]]; then
if [[ ! -f "$image_source" || "$image_source" =~ (auto|distro) ]]; then
# Fallback to distro ascii mode if custom ascii isn't found.
[[ "$image_source" != "distro" && ! -f "$image_source" ]] && \
[[ ! "$image_source" =~ (auto|distro) ]] && \
err "Ascii: Ascii file not found, using distro ascii."
if [[ -d "/usr/share/neofetch/ascii/distro" ]]; then
@ -2059,7 +2059,7 @@ get_ascii() {
get_image_source() {
case "$image_source" in
"wall"*)
"auto" | "wall"*)
get_wallpaper 2>/dev/null
;;
@ -3398,7 +3398,7 @@ get_term_padding() {
dynamic_prompt() {
case "$image_backend" in
"iterm2" | "w3m-img" | "tycat")
"iterm2" | "w3m" | "tycat")
get_term_padding 2>/dev/null
# Calculate image height in terminal cells.
@ -4001,7 +4001,7 @@ main() {
# w3m-img: Draw the image a second time to fix
# rendering issues in specific terminal emulators.
[[ "$image_program" == "w3m-img" ]] && display_image
[[ "$image_program" == *w3m* ]] && display_image
# Take a screenshot.
[[ "$scrot" == "on" ]] && take_scrot