From 5ade44b9b356faf21bfe27e1ef9351b9d6d85739 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 14 Jan 2017 15:30:37 +1100 Subject: [PATCH 01/31] Images add 'catimg' backend --- neofetch | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/neofetch b/neofetch index 0ff17521..de748d33 100755 --- a/neofetch +++ b/neofetch @@ -2357,6 +2357,7 @@ make_thumbnail() { } display_image() { + image_program="catimg" case "$image_program" in "w3m") # Add a tiny delay to fix issues with images not @@ -2373,6 +2374,12 @@ display_image() { "tycat") tycat "$image" || to_off "Images: tycat failed to display the image." ;; + + "catimg") + catimg -w "$columns" "$image" || to_off "Images: catimg failed to display the image." + text_padding="$((columns / 2 + gap))" + zws= + ;; esac } @@ -2548,7 +2555,7 @@ get_underline() { get_line_break() { # Print it directly. - printf "%s\n" "${zws} " + printf "%s\n" "${zws}" # Calculate info height. ((++info_height)) From 06acbacb74f6d789f29b10472bc1b091ca77c1cd Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 14 Jan 2017 15:43:34 +1100 Subject: [PATCH 02/31] Images: Add backend for caca --- neofetch | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/neofetch b/neofetch index de748d33..cc749238 100755 --- a/neofetch +++ b/neofetch @@ -2380,6 +2380,12 @@ display_image() { text_padding="$((columns / 2 + gap))" zws= ;; + + "caca") + img2txt -W "$((width / font_width))" -H "$((height / font_height))" --gamma=0.6 "$image" || to_off "Images: catimg failed to display the image." + text_padding="$((columns / 2 + gap))" + zws= + ;; esac } From 1c2569327f68d536cfa76efe35ff58b13e33c8b6 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 14 Jan 2017 20:59:12 +1100 Subject: [PATCH 03/31] Image: Rewrite image backends --- 2017-01-14-160401_515x360_scrot.png | Bin 0 -> 13970 bytes neofetch | 161 ++++++++++++++-------------- 2 files changed, 78 insertions(+), 83 deletions(-) create mode 100644 2017-01-14-160401_515x360_scrot.png diff --git a/2017-01-14-160401_515x360_scrot.png b/2017-01-14-160401_515x360_scrot.png new file mode 100644 index 0000000000000000000000000000000000000000..f205f3173ce280b222b912c7cbf95e3030810e74 GIT binary patch literal 13970 zcmeHujwcuE8C3_4dwYC{99kFaCQFXEV3L+kApDB15X^w;QB@EC}te;Agr_?KP=1{iLl1|0Uvpu1Iq@3fR z|L#y`R^9W#nd#uJ6AKWV^#ETBGwm7RIeVM2eGn`%w>v~(z${XKy8a<~RT&_+18GQq z#P?wNwEfA&W6aXd21K4psUpJnO-u@1(q8feUmltnTO@C5%F&(Ocw1JVg#*i7L7q5nIz|@n03!a2`$tBnsDs-nyKMkT?NGsgL*fO z&>FGLI|9rwifT{4G=v0|x8Bf80#9CxiP@+Kmu_@5S6rA=EUJ|pX)jS4J~D_v{6|yn z?16{WIA>2;@{&EyZhk(9eML~oxfvAt41j}e;*@~b@Isdpk-bDCl*%ahH4u<)q(-SB zyVM9cum0EQ*57l#?X?svRJEVe`O(LVw=MLCw4PFn(ljhskTc39@pknMQ&$B4?WXlg zrt$UBPw5pJjGoCcvxKV^bb(vq0zKppTF!Ui-WN_Xw|lgKj##(X8-X<+59g_RHbsF4 zzrCpjlSnRqPn}|aoY@E7{&VgH=ndh)SPov{NOCsxCti&N(&ilC;*fjeV{3#vy&BFW zop=A}LWHBqCd<*#U%I`DefYDvAu{qD8=F8f5$l&cS(bj-1B?~rreSGDWxOMy9+2T0 zQa|kdJQS{rIh%sz7i{{mN8bDu_FaHoeig0>y~xv3Jj|3ehpLkAX0wC0~F!EC}5EsJbXd!Um|XR_6#f8l#~xra|v50ZoQl-l4L$z zOq}MHM{?2Hp}O0aOM-O}!(Pc>`4!zx>j9-U8y?Ez2^>J=sZ_d3*oXlQ1DH=D88XEK z9fFqRr9AvHY*^}R)iI&V<*X6p6)yeqwb>%o&1qj89$1|?@B9V-i)M9%c1IPbDE%u? zOB<5jWHkj1^6DeYRw%7<2IXDkHnzWH%zJc+DvMxEm(~bUJLr9W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z3ajnSmW^-M+mAOukk*ZJ- zUbDYoL_b8mN%9mxhcgq>%j}ENToCxCUuA}mtcI7@z$#LGFx2AdoI3namopFkU%R(o>;M1& literal 0 HcmV?d00001 diff --git a/neofetch b/neofetch index 0ff17521..f384fe86 100755 --- a/neofetch +++ b/neofetch @@ -1941,54 +1941,45 @@ 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 + # Fallback to ascii mode if imagemagick isn't installed. + type -p convert >/dev/null 2>&1 || image_backend="ascii" - # 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" fi - # Get the image program. - get_image_program + 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 + case "${image_backend:-off}" in + "ascii") get_ascii ;; + "off") image_backend="off" ;; - 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 + "iterm2" | "w3m-img" | "tycat") + get_image_source - # 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_image_program + + if type -p "$image_program" >/dev/null 2>&1; then + err "Image: Drawing images using $image_program" + else + to_ascii "Image: Failed to find image program. ($image_program)" + err "Image: 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 + if [[ "$term_width" ]] && ((term_width >= 1)); then + clear + zws="​ " + else to_ascii "Image: Failed to find terminal window size" err "Image: Check the 'Images in the terminal' wiki page for more info" return @@ -1996,16 +1987,18 @@ get_image_backend() { 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 ;; - "ascii") get_ascii 2>/dev/null ;; + *) + image_backend="off" + err "Image: Unknown image backend specified. ($image_backend)" + err "Image: Valid backends are: 'iterm2', 'w3m-img'. 'tycat', 'ascii', 'off'" + err "Image: Falling back to off mode." + ;; 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" } @@ -2066,39 +2059,22 @@ get_ascii() { export LC_ALL=C } -get_image_program() { - if [[ -n "$ITERM_PROFILE" ]]; then - image_program="iterm2" +get_image_source() { + case "$image_source" in + "wall"*) + get_wallpaper 2>/dev/null + ;; - elif [[ "$(tycat 2>/dev/null)" ]]; then - image_program="tycat" + *) + if [[ -d "$image_source" ]]; then + files=("${image_source%/}"/*.{png,jpg,jpeg,jpe,gif}) + printf -v image "%s" "${files[RANDOM % (${#files[@]} - 1)]}" - else - image_program="w3m" - get_w3m_img_path - fi -} - -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 + else + image="$image_source" + fi + ;; + esac } get_wallpaper() { @@ -2162,6 +2138,33 @@ get_wallpaper() { [[ "${image/*\./}" == "xml" ]] && image="" } +get_image_program() { + if [[ -n "$ITERM_PROFILE" ]]; then + image_program="iterm2" + + elif [[ "$(tycat 2>/dev/null)" ]]; then + image_program="tycat" + + else + # Find w3m-img path. + if [[ -x "$w3m_img_path" ]]; then + image_program="$w3m_img_path" + + elif [[ -x "/usr/lib/w3m/w3mimgdisplay" ]]; then + image_program="/usr/lib/w3m/w3mimgdisplay" + + elif [[ -x "/usr/libexec/w3m/w3mimgdisplay" ]]; then + image_program="/usr/libexec/w3m/w3mimgdisplay" + + elif [[ -x "/usr/lib64/w3m/w3mimgdisplay" ]]; then + image_program="/usr/lib64/w3m/w3mimgdisplay" + + elif [[ -x "/usr/libexec64/w3m/w3mimgdisplay" ]]; then + image_program="/usr/libexec64/w3m/w3mimgdisplay" + fi + fi +} + get_term_size() { # This functions gets the current window size in # pixels. @@ -2230,12 +2233,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() { @@ -2358,7 +2355,7 @@ make_thumbnail() { display_image() { case "$image_program" in - "w3m") + *"w3m"*) # Add a tiny delay to fix issues with images not # appearing in specific terminal emulators. sleep 0.05 @@ -2383,9 +2380,6 @@ to_ascii() { # Print the ascii art. get_ascii 2>/dev/null - # Move cursor next to ascii art. - printf "%b" "\033[${lines:-0}A\033[9999999D" - # Log the error. err "$1" } @@ -3404,7 +3398,7 @@ get_term_padding() { dynamic_prompt() { case "$image_backend" in - "image") + "iterm2" | "w3m-img" | "tycat") get_term_padding 2>/dev/null # Calculate image height in terminal cells. @@ -4001,7 +3995,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 From 2e168a4d87431fa02ddfbad1f128faa272f2fb8a Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 14 Jan 2017 20:59:18 +1100 Subject: [PATCH 04/31] Image: Rewrite image backends --- 2017-01-14-160401_515x360_scrot.png | Bin 13970 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 2017-01-14-160401_515x360_scrot.png diff --git a/2017-01-14-160401_515x360_scrot.png b/2017-01-14-160401_515x360_scrot.png deleted file mode 100644 index f205f3173ce280b222b912c7cbf95e3030810e74..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 13970 zcmeHujwcuE8C3_4dwYC{99kFaCQFXEV3L+kApDB15X^w;QB@EC}te;Agr_?KP=1{iLl1|0Uvpu1Iq@3fR z|L#y`R^9W#nd#uJ6AKWV^#ETBGwm7RIeVM2eGn`%w>v~(z${XKy8a<~RT&_+18GQq z#P?wNwEfA&W6aXd21K4psUpJnO-u@1(q8feUmltnTO@C5%F&(Ocw1JVg#*i7L7q5nIz|@n03!a2`$tBnsDs-nyKMkT?NGsgL*fO z&>FGLI|9rwifT{4G=v0|x8Bf80#9CxiP@+Kmu_@5S6rA=EUJ|pX)jS4J~D_v{6|yn z?16{WIA>2;@{&EyZhk(9eML~oxfvAt41j}e;*@~b@Isdpk-bDCl*%ahH4u<)q(-SB zyVM9cum0EQ*57l#?X?svRJEVe`O(LVw=MLCw4PFn(ljhskTc39@pknMQ&$B4?WXlg zrt$UBPw5pJjGoCcvxKV^bb(vq0zKppTF!Ui-WN_Xw|lgKj##(X8-X<+59g_RHbsF4 zzrCpjlSnRqPn}|aoY@E7{&VgH=ndh)SPov{NOCsxCti&N(&ilC;*fjeV{3#vy&BFW zop=A}LWHBqCd<*#U%I`DefYDvAu{qD8=F8f5$l&cS(bj-1B?~rreSGDWxOMy9+2T0 zQa|kdJQS{rIh%sz7i{{mN8bDu_FaHoeig0>y~xv3Jj|3ehpLkAX0wC0~F!EC}5EsJbXd!Um|XR_6#f8l#~xra|v50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-pt#oou{2X(GzN04fNS|+R>F5UkQ6F0 zv{%#yc=+PT;KO-7flFk}lZb3uRRH{6~vG3{=#DzNy?xRK;|s^N5&; z5n<$G`b!1d0Yyb2n7b+;Vt#A?4XwFf76+zr<9{CbpI!QY*fbzA`hByD;#Xd6=l1)j zId|92x{ME`%NlJX`sDmn7wd@1G+8kbVkweU}sGNP+xCbX4I) z3ajnSmW^-M+mAOukk*ZJ- zUbDYoL_b8mN%9mxhcgq>%j}ENToCxCUuA}mtcI7@z$#LGFx2AdoI3namopFkU%R(o>;M1& From 8d0630afddb09a99873e893f4099e04bf0c7c5c5 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 14 Jan 2017 20:59:54 +1100 Subject: [PATCH 05/31] Image: Remove hard-coded var --- neofetch | 2 -- 1 file changed, 2 deletions(-) diff --git a/neofetch b/neofetch index f384fe86..8b9bc22e 100755 --- a/neofetch +++ b/neofetch @@ -1950,8 +1950,6 @@ image_backend() { [[ -z "$DISPLAY" ]] && image_source="ascii" fi - image_backend="off" - case "${image_backend:-off}" in "ascii") get_ascii ;; "off") image_backend="off" ;; From 68f899854425445a43f3b0daad3bc87090e19448 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 14 Jan 2017 21:09:04 +1100 Subject: [PATCH 06/31] Image: Universal image source --- neofetch | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/neofetch b/neofetch index 8b9bc22e..89e53c73 100755 --- a/neofetch +++ b/neofetch @@ -2001,9 +2001,9 @@ image_backend() { } get_ascii() { - if [[ ! -f "$ascii" || "$ascii" == "distro" ]]; then + if [[ ! -f "$image_source" || "$image_source" == "distro" ]]; then # Fallback to distro ascii mode if custom ascii isn't found. - [[ "$ascii" != "distro" && ! -f "$ascii" ]] && \ + [[ "$image_source" != "distro" && ! -f "$image_source" ]] && \ err "Ascii: Ascii file not found, using distro ascii." if [[ -d "/usr/share/neofetch/ascii/distro" ]]; then @@ -2020,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 @@ -2039,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,6 +2073,8 @@ get_image_source() { fi ;; esac + + err "Image: Using image $image" } get_wallpaper() { @@ -3896,11 +3898,8 @@ get_args() { "--disk_display") disk_display="$2" ;; # Image - "--image") - image_source="$2" - case "$2" in "-"* | "" | "ascii") image_backend="ascii" ;; esac - ;; - + "--image_backend") image_backend="$2" ;; + "--image_source") image_source="$2" ;; "--image_size" | "--size") image_size="$2" ;; "--crop_mode") crop_mode="$2" ;; "--crop_offset") crop_offset="$2" ;; @@ -4002,7 +4001,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-img" ]] && display_image # Take a screenshot. [[ "$scrot" == "on" ]] && take_scrot From cb68028310a8ce793af486ac6ec2d49ed3cc0d5e Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 14 Jan 2017 21:49:32 +1100 Subject: [PATCH 07/31] General: Fix more bugs --- config/config | 61 ++++++++++++++++++++++++++------------------------- neofetch | 16 +++++++------- 2 files changed, 39 insertions(+), 38 deletions(-) diff --git a/config/config b/config/config index 7fe75e6d..dfa42620 100644 --- a/config/config +++ b/config/config @@ -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 # diff --git a/neofetch b/neofetch index 89e53c73..ddb6b600 100755 --- a/neofetch +++ b/neofetch @@ -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 From 25188ceb1fb9ff1fd3a949cb009ddb5c249e0c58 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 14 Jan 2017 21:51:26 +1100 Subject: [PATCH 08/31] Args: Added image shortcut flags --- neofetch | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/neofetch b/neofetch index ddb6b600..f1fe7f86 100755 --- a/neofetch +++ b/neofetch @@ -3897,9 +3897,16 @@ get_args() { "--battery_display") battery_display="$2" ;; "--disk_display") disk_display="$2" ;; - # Image + # Image backend "--image_backend") image_backend="$2" ;; "--image_source") image_source="$2" ;; + "--w3m") image_backend="w3m" ;; + "--iterm2") image_backend="iterm2" ;; + "--tycat") image_backend="tycat" ;; + "--ascii") image_backend="ascii" ;; + "--off") image_backend="off" ;; + + # Image options "--image_size" | "--size") image_size="$2" ;; "--crop_mode") crop_mode="$2" ;; "--crop_offset") crop_offset="$2" ;; From 5c425e2b8eaf6a290a552c91ac3d44d8edf32d51 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 14 Jan 2017 22:12:22 +1100 Subject: [PATCH 09/31] Config: Restructure config --- config/config | 81 ++++++++++++++++++++++++++------------------------- 1 file changed, 42 insertions(+), 39 deletions(-) diff --git a/config/config b/config/config index dfa42620..338c639b 100644 --- a/config/config +++ b/config/config @@ -524,7 +524,7 @@ battery_display="off" disk_display="off" -# Image Options +# Backend Settings # Image backend. # @@ -547,6 +547,47 @@ image_backend="ascii" 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 # # Default: '~/.cache/thumbnails/neofetch' @@ -607,44 +648,6 @@ xoffset=0 background_color= -# 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" - - # Scrot Options From 3b1dc8ce243fa52558551da7e480ac7306a7e56e Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 14 Jan 2017 22:21:46 +1100 Subject: [PATCH 10/31] Docs: Write documentation for new image modes --- neofetch | 57 +++++++++++++++++++++--------------- neofetch.1 | 85 ++++++++++++++++++++++++++++++++---------------------- 2 files changed, 84 insertions(+), 58 deletions(-) diff --git a/neofetch b/neofetch index f1fe7f86..324f5c19 100755 --- a/neofetch +++ b/neofetch @@ -3701,10 +3701,40 @@ BARS: Takes: bar, infobar, barinfo, off --disk_display mode Bar mode. Takes: bar, infobar, barinfo, off + +IMAGE BACKEND: + --image_backend backend Which image backend to use. + Possible values: 'ascii', 'w3m', 'iterm2', 'tycat', 'off' + --image_source source Which image or ascii file to use. + Possible values: 'auto', 'ascii', 'wallpaper', '/path/to/img', '/path/to/ascii', '/path/to/dir/' + --w3m Shortcut to use 'w3m' backend. + --iterm2 Shortcut to use 'iterm2' backend. + --tycat Shortcut to use 'tycat' backend. + --ascii Shortcut to use 'ascii' backend. + --off Shortcut to use 'off' backend. + +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 + + NOTE: Arch and Ubuntu have 'old' logo variants. + + NOTE: Use 'arch_old' or 'ubuntu_old' to use the old logos. + + NOTE: Ubuntu has flavor variants. + + NOTE: Change this to 'Lubuntu', 'Xubuntu', 'Ubuntu-GNOME', 'Ubuntu-Studio' or 'Ubuntu-Budgie' to use the flavors. + + NOTE: Alpine, Arch, Crux, Gentoo, OpenBSD, and Void have a smaller logo variant. + + NOTE: Change this to 'alpine_small', 'arch_small', 'crux_small', 'gentoo_small', 'openbsd_small', and 'void_small' to use the small logos. + + --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: - --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 @@ -3725,27 +3755,6 @@ IMAGE: --clean Delete cached files and thumbnails. -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 - - NOTE: Arch and Ubuntu have 'old' logo variants. - - NOTE: Use 'arch_old' or 'ubuntu_old' to use the old logos. - - NOTE: Ubuntu has flavor variants. - - NOTE: Change this to 'Lubuntu', 'Xubuntu', 'Ubuntu-GNOME', 'Ubuntu-Studio' or 'Ubuntu-Budgie' to use the flavors. - - NOTE: Alpine, Arch, Crux, Gentoo, OpenBSD, and Void have a smaller logo variant. - - NOTE: Change this to 'alpine_small', 'arch_small', 'crux_small', 'gentoo_small', 'openbsd_small', and 'void_small' to use the small logos. - - --ascii_bold on/off Whether or not to bold the ascii logo. - -L, --logo Hide the info text and only show the ascii logo. - 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. diff --git a/neofetch.1 b/neofetch.1 index f6d6468e..90115ad7 100644 --- a/neofetch.1 +++ b/neofetch.1 @@ -171,12 +171,58 @@ Takes: bar, infobar, barinfo, off \fB\-\-disk_display\fR mode Bar mode. Takes: 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\-\-image_backend\fR backend +Which image backend to use. +Possible values: 'ascii', 'w3m', 'iterm2', 'tycat', 'off' +.TP +\fB\-\-image_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\-\-w3m\fR +Shortcut to use 'w3m' backend. +.TP +\fB\-\-iterm2\fR +Shortcut to use 'iterm2' backend. +.TP +\fB\-\-tycat\fR +Shortcut to use 'tycat' backend. +.TP +\fB\-\-ascii\fR +Shortcut to use 'ascii' backend. +.TP +\fB\-\-off\fR +Shortcut to use 'off' backend. +.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. @@ -210,35 +256,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 From c3b82ecc31ff504b14351517a3371ccb8bfd3e8c Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 14 Jan 2017 22:32:08 +1100 Subject: [PATCH 11/31] Args: Remove old --ascii arg --- neofetch | 7 ------- 1 file changed, 7 deletions(-) diff --git a/neofetch b/neofetch index 324f5c19..fdf9532c 100755 --- a/neofetch +++ b/neofetch @@ -3930,13 +3930,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 From e347d9c8cef138782a4702d05c063c9eb474d843 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 14 Jan 2017 22:39:58 +1100 Subject: [PATCH 12/31] Ascii: Fix old option --- neofetch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/neofetch b/neofetch index fdf9532c..1a959690 100755 --- a/neofetch +++ b/neofetch @@ -2001,9 +2001,9 @@ image_backend() { } get_ascii() { - if [[ ! -f "$image_source" || "$image_source" =~ (auto|distro) ]]; then + if [[ ! -f "$image_source" || "$image_source" =~ (auto|ascii) ]]; then # Fallback to distro ascii mode if custom ascii isn't found. - [[ ! "$image_source" =~ (auto|distro) ]] && \ + [[ ! "$image_source" =~ (auto|ascii) ]] && \ err "Ascii: Ascii file not found, using distro ascii." if [[ -d "/usr/share/neofetch/ascii/distro" ]]; then From 54cb88f4a6e63acde16ec89f4b6447172219046c Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 14 Jan 2017 22:53:36 +1100 Subject: [PATCH 13/31] Image: Fixed bugs --- neofetch | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/neofetch b/neofetch index 1a959690..b9bbed81 100755 --- a/neofetch +++ b/neofetch @@ -1958,7 +1958,7 @@ image_backend() { get_image_source if [[ ! -f "$image" ]]; then - to_ascii "Image: \'$image_source\' doesn't exist, falling back to ascii mode." + to_ascii "Image: '$image_source' doesn't exist, falling back to ascii mode." return fi @@ -2380,6 +2380,9 @@ to_ascii() { # Print the ascii art. get_ascii 2>/dev/null + # Set cursor position next image/ascii. + printf "%b" "\033[${lines:-0}A\033[9999999D" + # Log the error. err "$1" } @@ -3810,7 +3813,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 From 281fd368cea32387d299608d2967f145ad861689 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 14 Jan 2017 22:59:07 +1100 Subject: [PATCH 14/31] General: Make to_ functions print the error first --- neofetch | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/neofetch b/neofetch index b9bbed81..29030399 100755 --- a/neofetch +++ b/neofetch @@ -2374,6 +2374,9 @@ display_image() { } to_ascii() { + # Log the error. + err "$1" + # This function makes neofetch fallback to ascii mode. image_backend="ascii" @@ -2382,17 +2385,14 @@ to_ascii() { # 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 From 33da61b7619f15447aec6836b0106fff9233d20a Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 14 Jan 2017 23:01:34 +1100 Subject: [PATCH 15/31] Error: Better error message --- neofetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neofetch b/neofetch index 29030399..9bcab5fb 100755 --- a/neofetch +++ b/neofetch @@ -1967,7 +1967,7 @@ image_backend() { if type -p "$image_program" >/dev/null 2>&1; then err "Image: Drawing images using $image_program" else - to_ascii "Image: Failed to find image program. ($image_program)" + to_ascii "Image: Failed to find image program '$image_program'" err "Image: Falling back to ascii mode." return fi From 08dfd49d04d5d5a7da4886e5b5aee2687ba5a531 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 14 Jan 2017 23:05:52 +1100 Subject: [PATCH 16/31] Images: Fixed fallback --- neofetch | 1 + 1 file changed, 1 insertion(+) diff --git a/neofetch b/neofetch index 9bcab5fb..e7c29239 100755 --- a/neofetch +++ b/neofetch @@ -1978,6 +1978,7 @@ image_backend() { 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 From b41a75609eeab3767041e1a159be89a5eaf40e58 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 14 Jan 2017 23:08:47 +1100 Subject: [PATCH 17/31] Images: Fix unknown image backend fallback --- neofetch | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/neofetch b/neofetch index e7c29239..c1a4f96d 100755 --- a/neofetch +++ b/neofetch @@ -1965,9 +1965,9 @@ image_backend() { get_image_program if type -p "$image_program" >/dev/null 2>&1; then - err "Image: Drawing images using $image_program" + err "Image: Drawing images using '$image_program'." else - to_ascii "Image: Failed to find image program '$image_program'" + to_ascii "Image: Failed to find image program '$image_program'." err "Image: Falling back to ascii mode." return fi @@ -1979,8 +1979,8 @@ image_backend() { 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" + to_ascii "Image: Failed to find terminal window size." + err "Image: Check the 'Images in the terminal' wiki page for more info," return fi @@ -1990,10 +1990,10 @@ image_backend() { ;; *) - image_backend="off" - err "Image: Unknown image backend specified. ($image_backend)" + err "Image: Unknown image backend specified '$image_backend'." err "Image: Valid backends are: 'iterm2', 'w3m'. 'tycat', 'ascii', 'off'" - err "Image: Falling back to off mode." + err "Image: Falling back to ascii mode." + get_ascii ;; esac From d8712286f821e949d4f436f3e1c5cccb63d8d6f6 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 14 Jan 2017 23:37:39 +1100 Subject: [PATCH 18/31] Images: Add support for catimg and caca --- config/config | 2 +- neofetch | 77 ++++++++++++++++++++++----------------------------- neofetch.1 | 22 +++++++++------ 3 files changed, 48 insertions(+), 53 deletions(-) diff --git a/config/config b/config/config index 338c639b..d14fe831 100644 --- a/config/config +++ b/config/config @@ -529,7 +529,7 @@ disk_display="off" # Image backend. # # Default: 'ascii' -# Values: 'ascii', 'w3m', 'iterm2', 'tycat', 'off' +# Values: 'ascii', 'caca', 'catimg', 'iterm2', 'off', 'tycat', 'w3m' # Flag: --image_backend image_backend="ascii" diff --git a/neofetch b/neofetch index e529730d..c9491663 100755 --- a/neofetch +++ b/neofetch @@ -1954,7 +1954,7 @@ image_backend() { "ascii") get_ascii ;; "off") image_backend="off" ;; - "iterm2" | "w3m" | "tycat") + "iterm2" | "w3m" | "tycat" | "catimg" | "caca") get_image_source if [[ ! -f "$image" ]]; then @@ -1962,16 +1962,6 @@ image_backend() { return fi - get_image_program - - if type -p "$image_program" >/dev/null 2>&1; then - err "Image: Drawing images using '$image_program'." - else - to_ascii "Image: Failed to find image program '$image_program'." - err "Image: Falling back to ascii mode." - return - fi - get_term_size if [[ "$term_width" ]] && ((term_width >= 1)); then @@ -1995,6 +1985,7 @@ image_backend() { err "Image: Falling back to ascii mode." get_ascii ;; + esac # Set cursor position next image/ascii. @@ -2139,30 +2130,22 @@ get_wallpaper() { [[ "${image/*\./}" == "xml" ]] && image="" } -get_image_program() { - if [[ -n "$ITERM_PROFILE" ]]; then - image_program="iterm2" +get_w3m_img_path() { + # Find w3m-img path. + if [[ -x "$w3m_img_path" ]]; then + w3m_img_path="$w3m_img_path" - elif [[ "$(tycat 2>/dev/null)" ]]; then - image_program="tycat" + elif [[ -x "/usr/lib/w3m/w3mimgdisplay" ]]; then + w3m_img_path="/usr/lib/w3m/w3mimgdisplay" - else - # Find w3m-img path. - if [[ -x "$w3m_img_path" ]]; then - image_program="$w3m_img_path" + elif [[ -x "/usr/libexec/w3m/w3mimgdisplay" ]]; then + w3m_img_path="/usr/libexec/w3m/w3mimgdisplay" - elif [[ -x "/usr/lib/w3m/w3mimgdisplay" ]]; then - image_program="/usr/lib/w3m/w3mimgdisplay" + elif [[ -x "/usr/lib64/w3m/w3mimgdisplay" ]]; then + w3m_img_path="/usr/lib64/w3m/w3mimgdisplay" - elif [[ -x "/usr/libexec/w3m/w3mimgdisplay" ]]; then - image_program="/usr/libexec/w3m/w3mimgdisplay" - - elif [[ -x "/usr/lib64/w3m/w3mimgdisplay" ]]; then - image_program="/usr/lib64/w3m/w3mimgdisplay" - - elif [[ -x "/usr/libexec64/w3m/w3mimgdisplay" ]]; then - image_program="/usr/libexec64/w3m/w3mimgdisplay" - fi + elif [[ -x "/usr/libexec64/w3m/w3mimgdisplay" ]]; then + w3m_img_path="/usr/libexec64/w3m/w3mimgdisplay" fi } @@ -2355,14 +2338,15 @@ make_thumbnail() { } display_image() { - image_program="catimg" - case "$image_program" in - *"w3m"*) + case "$image_backend" in + "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" -bg "$background_color" >/dev/null & 2>&1 || to_off "Images: w3m-img failed to display the image." + "${w3m_img_path:-false}" -bg "$background_color" >/dev/null & 2>&1 || to_off "Images: w3m-img failed to display the image." ;; "iterm2") @@ -3415,13 +3399,14 @@ get_term_padding() { dynamic_prompt() { case "$image_backend" in - "iterm2" | "w3m" | "tycat") + "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 @@ -3721,14 +3706,16 @@ BARS: IMAGE BACKEND: --image_backend backend Which image backend to use. - Possible values: 'ascii', 'w3m', 'iterm2', 'tycat', 'off' + Possible values: 'ascii', 'caca', 'catimg', 'iterm2', 'off', 'tycat', 'w3m' --image_source source Which image or ascii file to use. Possible values: 'auto', 'ascii', 'wallpaper', '/path/to/img', '/path/to/ascii', '/path/to/dir/' - --w3m Shortcut to use 'w3m' backend. - --iterm2 Shortcut to use 'iterm2' backend. - --tycat Shortcut to use 'tycat' backend. --ascii Shortcut to use 'ascii' backend. + --caca Shortcut to use 'caca' backend. + --catimg Shortcut to use 'catimg' backend. + --iterm2 Shortcut to use 'iterm2' backend. --off Shortcut to use 'off' backend. + --tycat Shortcut to use 'tycat' backend. + --w3m Shortcut to use 'w3m' backend. ASCII: --ascii_colors x x x x x x Colors to print the ascii art @@ -3926,11 +3913,13 @@ get_args() { # Image backend "--image_backend") image_backend="$2" ;; "--image_source") image_source="$2" ;; - "--w3m") image_backend="w3m" ;; - "--iterm2") image_backend="iterm2" ;; - "--tycat") image_backend="tycat" ;; "--ascii") image_backend="ascii" ;; + "--caca") image_backend="caca" ;; + "--catimg") image_backend="catimg" ;; + "--iterm2") image_backend="iterm2" ;; "--off") image_backend="off" ;; + "--tycat") image_backend="tycat" ;; + "--w3m") image_backend="w3m" ;; # Image options "--image_size" | "--size") image_size="$2" ;; diff --git a/neofetch.1 b/neofetch.1 index 90115ad7..57ad4ad1 100644 --- a/neofetch.1 +++ b/neofetch.1 @@ -175,26 +175,32 @@ Takes: bar, infobar, barinfo, off .TP \fB\-\-image_backend\fR backend Which image backend to use. -Possible values: 'ascii', 'w3m', 'iterm2', 'tycat', 'off' +Possible values: 'ascii', 'caca', 'catimg', 'iterm2', 'off', 'tycat', 'w3m' .TP \fB\-\-image_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\-\-w3m\fR -Shortcut to use 'w3m' backend. +\fB\-\-ascii\fR +Shortcut to use 'ascii' backend. +.TP +\fB\-\-caca\fR +Shortcut to use 'caca' backend. +.TP +\fB\-\-catimg\fR +Shortcut to use 'catimg' backend. .TP \fB\-\-iterm2\fR Shortcut to use 'iterm2' backend. .TP +\fB\-\-off\fR +Shortcut to use 'off' backend. +.TP \fB\-\-tycat\fR Shortcut to use 'tycat' backend. .TP -\fB\-\-ascii\fR -Shortcut to use 'ascii' backend. -.TP -\fB\-\-off\fR -Shortcut to use 'off' backend. +\fB\-\-w3m\fR +Shortcut to use 'w3m' backend. .SS "ASCII:" .TP \fB\-\-ascii_colors\fR x x x x x x From db4c19cc5815a082046dc531546531a4f8c6912c Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 15 Jan 2017 00:15:33 +1100 Subject: [PATCH 19/31] Image: Added new backend for jp2a --- config/config | 2 +- neofetch | 44 +++++++++++++++++++++++++------------------- neofetch.1 | 2 +- 3 files changed, 27 insertions(+), 21 deletions(-) diff --git a/config/config b/config/config index d14fe831..3969b332 100644 --- a/config/config +++ b/config/config @@ -529,7 +529,7 @@ disk_display="off" # Image backend. # # Default: 'ascii' -# Values: 'ascii', 'caca', 'catimg', 'iterm2', 'off', 'tycat', 'w3m' +# Values: 'ascii', 'caca', 'catimg', 'jp2a', 'iterm2', 'off', 'tycat', 'w3m' # Flag: --image_backend image_backend="ascii" diff --git a/neofetch b/neofetch index c9491663..2c1abfe9 100755 --- a/neofetch +++ b/neofetch @@ -1954,7 +1954,7 @@ image_backend() { "ascii") get_ascii ;; "off") image_backend="off" ;; - "iterm2" | "w3m" | "tycat" | "catimg" | "caca") + "caca" | "catimg" | "jp2a" | "iterm2" | "tycat" | "w3m") get_image_source if [[ ! -f "$image" ]]; then @@ -1985,7 +1985,6 @@ image_backend() { err "Image: Falling back to ascii mode." get_ascii ;; - esac # Set cursor position next image/ascii. @@ -2339,14 +2338,22 @@ make_thumbnail() { display_image() { case "$image_backend" in - "w3m") - get_w3m_img_path + "caca") + img2txt -W "$((width / font_width))" -H "$((height / font_height))" --gamma=0.6 "$image" || to_off "Images: catimg failed to display the image." + text_padding="$((columns / 2 + gap))" + zws= + ;; - # 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 "Images: w3m-img failed to display the image." + "catimg") + catimg -w "$columns" "$image" || to_off "Images: catimg failed to display the image." + text_padding="$((columns / 2 + gap))" + zws= + ;; + + "jp2a") + jp2a --width="$((width / font_width))" --colors "$image" || to_off "Images: jp2a failed to display the image." + text_padding="$((columns / 2 + gap))" + zws= ;; "iterm2") @@ -2357,16 +2364,14 @@ display_image() { tycat "$image" || to_off "Images: tycat failed to display the image." ;; - "catimg") - catimg -w "$columns" "$image" || to_off "Images: catimg failed to display the image." - text_padding="$((columns / 2 + gap))" - zws= - ;; + "w3m") + get_w3m_img_path - "caca") - img2txt -W "$((width / font_width))" -H "$((height / font_height))" --gamma=0.6 "$image" || to_off "Images: catimg failed to display the image." - text_padding="$((columns / 2 + gap))" - zws= + # 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 "Images: w3m-img failed to display the image." ;; esac } @@ -3706,7 +3711,7 @@ BARS: IMAGE BACKEND: --image_backend backend Which image backend to use. - Possible values: 'ascii', 'caca', 'catimg', 'iterm2', 'off', 'tycat', 'w3m' + Possible values: 'ascii', 'caca', 'catimg', 'jp2a', 'iterm2', 'off', 'tycat', 'w3m' --image_source source Which image or ascii file to use. Possible values: 'auto', 'ascii', 'wallpaper', '/path/to/img', '/path/to/ascii', '/path/to/dir/' --ascii Shortcut to use 'ascii' backend. @@ -3916,6 +3921,7 @@ get_args() { "--ascii") image_backend="ascii" ;; "--caca") image_backend="caca" ;; "--catimg") image_backend="catimg" ;; + "--jp2a") image_backend="jp2a" ;; "--iterm2") image_backend="iterm2" ;; "--off") image_backend="off" ;; "--tycat") image_backend="tycat" ;; diff --git a/neofetch.1 b/neofetch.1 index 57ad4ad1..cd25dcac 100644 --- a/neofetch.1 +++ b/neofetch.1 @@ -175,7 +175,7 @@ Takes: bar, infobar, barinfo, off .TP \fB\-\-image_backend\fR backend Which image backend to use. -Possible values: 'ascii', 'caca', 'catimg', 'iterm2', 'off', 'tycat', 'w3m' +Possible values: 'ascii', 'caca', 'catimg', 'jp2a', 'iterm2', 'off', 'tycat', 'w3m' .TP \fB\-\-image_source\fR source Which image or ascii file to use. From 853bd8c941b101cf3ee6d4aa7575d35741cc394a Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 15 Jan 2017 00:19:09 +1100 Subject: [PATCH 20/31] Images: Fix broken image sizing --- neofetch | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/neofetch b/neofetch index 2c1abfe9..70434f7f 100755 --- a/neofetch +++ b/neofetch @@ -2339,20 +2339,17 @@ make_thumbnail() { display_image() { case "$image_backend" in "caca") - img2txt -W "$((width / font_width))" -H "$((height / font_height))" --gamma=0.6 "$image" || to_off "Images: catimg failed to display the image." - text_padding="$((columns / 2 + gap))" + img2txt -W "$((width / font_width)))" -H "$((height / font_height))" --gamma=0.6 "$image" || to_off "Images: catimg failed to display the image." zws= ;; "catimg") - catimg -w "$columns" "$image" || to_off "Images: catimg failed to display the image." - text_padding="$((columns / 2 + gap))" + catimg -w "$((columns + gap))" "$image" || to_off "Images: catimg failed to display the image." zws= ;; "jp2a") jp2a --width="$((width / font_width))" --colors "$image" || to_off "Images: jp2a failed to display the image." - text_padding="$((columns / 2 + gap))" zws= ;; From 87cc686070fa562f299051966ee3eaffe0ad6410 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 15 Jan 2017 00:22:55 +1100 Subject: [PATCH 21/31] Image: Fix bug when backend renderer isn't found --- neofetch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/neofetch b/neofetch index 70434f7f..892a3817 100755 --- a/neofetch +++ b/neofetch @@ -1976,7 +1976,7 @@ image_backend() { get_image_size make_thumbnail - display_image + display_image 2>/dev/null ;; *) @@ -4019,7 +4019,7 @@ main() { # w3m-img: Draw the image a second time to fix # rendering issues in specific terminal emulators. - [[ "$image_program" == *w3m* ]] && display_image + [[ "$image_program" == *w3m* ]] && display_image 2>/dev/null # Take a screenshot. [[ "$scrot" == "on" ]] && take_scrot From 845dc830ba1d8929cabe48daabfae9514bea0c7a Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 15 Jan 2017 08:43:22 +1100 Subject: [PATCH 22/31] Image: Added error about missing imagemagick --- neofetch | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/neofetch b/neofetch index 892a3817..74f4b874 100755 --- a/neofetch +++ b/neofetch @@ -1942,9 +1942,11 @@ get_cols() { # IMAGES image_backend() { - if [[ ! "${image_backend}" =~ (off|ascii) ]]; then - # Fallback to ascii mode if imagemagick isn't installed. - type -p convert >/dev/null 2>&1 || image_backend="ascii" + 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 X isn't running force ascii mode here. [[ -z "$DISPLAY" ]] && image_backend="ascii" @@ -1981,7 +1983,7 @@ image_backend() { *) err "Image: Unknown image backend specified '$image_backend'." - err "Image: Valid backends are: 'iterm2', 'w3m'. 'tycat', 'ascii', 'off'" + err "Image: Valid backends are: 'ascii', 'caca', 'catimg', 'jp2a', 'iterm2', 'off', 'tycat', 'w3m')" err "Image: Falling back to ascii mode." get_ascii ;; @@ -2339,17 +2341,17 @@ make_thumbnail() { display_image() { case "$image_backend" in "caca") - img2txt -W "$((width / font_width)))" -H "$((height / font_height))" --gamma=0.6 "$image" || to_off "Images: catimg failed to display the image." + 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 "$((columns + gap))" "$image" || to_off "Images: catimg failed to display the image." + catimg -w "$((columns + gap))" "$image" || to_off "Image: catimg failed to display the image." zws= ;; "jp2a") - jp2a --width="$((width / font_width))" --colors "$image" || to_off "Images: jp2a failed to display the image." + jp2a --width="$((width / font_width))" --colors "$image" || to_off "Image: jp2a failed to display the image." zws= ;; @@ -2358,7 +2360,7 @@ 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") @@ -2368,7 +2370,7 @@ display_image() { # 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 "Images: w3m-img failed to display the image." + "${w3m_img_path:-false}" -bg "$background_color" >/dev/null & 2>&1 || to_off "Image: w3m-img failed to display the image." ;; esac } From f052c6ad9db778b3225d7d80a9335ba89bb0b146 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 15 Jan 2017 08:51:17 +1100 Subject: [PATCH 23/31] Image: [catimg] Fix incorrect image sizing --- neofetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neofetch b/neofetch index 74f4b874..9e5f3239 100755 --- a/neofetch +++ b/neofetch @@ -2346,7 +2346,7 @@ display_image() { ;; "catimg") - catimg -w "$((columns + gap))" "$image" || to_off "Image: catimg failed to display the image." + catimg -w "$((width / font_width * 2))" -r 0 "$image" || to_off "Image: catimg failed to display the image." zws= ;; From 4d00a4dac1b6db4410ebd7e0513006fefc3ae92a Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 15 Jan 2017 08:57:40 +1100 Subject: [PATCH 24/31] Image: [catimg] Fix math order --- neofetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neofetch b/neofetch index 9e5f3239..c19ee6ca 100755 --- a/neofetch +++ b/neofetch @@ -2346,7 +2346,7 @@ display_image() { ;; "catimg") - catimg -w "$((width / font_width * 2))" -r 0 "$image" || to_off "Image: catimg failed to display the image." + catimg -w "$((width * 2 / font_width))" -r 0 "$image" || to_off "Image: catimg failed to display the image." zws= ;; From b6a55cf91db98985d1586f6a2a9c63bfd3184be9 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 15 Jan 2017 09:18:17 +1100 Subject: [PATCH 25/31] Config: Remove 'w3m_img_path' --- config/config | 16 ---------------- neofetch | 8 ++++---- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/config/config b/config/config index 3969b332..305c8cb6 100644 --- a/config/config +++ b/config/config @@ -705,22 +705,6 @@ 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 # # Default: 'on' diff --git a/neofetch b/neofetch index c19ee6ca..ec2ecf60 100755 --- a/neofetch +++ b/neofetch @@ -2133,10 +2133,7 @@ get_wallpaper() { get_w3m_img_path() { # Find w3m-img path. - if [[ -x "$w3m_img_path" ]]; then - w3m_img_path="$w3m_img_path" - - elif [[ -x "/usr/lib/w3m/w3mimgdisplay" ]]; then + if [[ -x "/usr/lib/w3m/w3mimgdisplay" ]]; then w3m_img_path="/usr/lib/w3m/w3mimgdisplay" elif [[ -x "/usr/libexec/w3m/w3mimgdisplay" ]]; then @@ -2147,6 +2144,9 @@ get_w3m_img_path() { 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 } From cbd6dfb899ca230763081be0be5999f764ca8650 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 15 Jan 2017 09:21:05 +1100 Subject: [PATCH 26/31] Config: Remove leftover options --- config/config | 26 -------------------------- neofetch | 8 ++++---- 2 files changed, 4 insertions(+), 30 deletions(-) diff --git a/config/config b/config/config index 305c8cb6..36425fc6 100644 --- a/config/config +++ b/config/config @@ -701,29 +701,3 @@ scrot_name="neofetch-$(date +%F-%I-%M-%S-${RANDOM}).png" # NOTE: If you'd like another image host to be added to Neofetch. # Open an issue on github. image_host="teknik" - - -# Config Options - -# Enable/Disable config file -# -# Default: 'on' -# Values: 'on', 'off' -# Flag: --config -# --config off, none -# -# Note: This option is only used when neofetch sources this config -# as a default config and NOT as a user config. Changing this in -# your user config won't actually do anything. -config="on" - -# Path to custom config file location -# -# Default: '${XDG_CONFIG_HOME:-${HOME}/.config}/neofetch/config' -# Values: '/path/to/config' -# Flag: --config_file -# -# Note: This option is only used when neofetch sources this config -# as a default config and NOT as a user config. Changing this in -# your user config won't actually do anything. -config_file="${XDG_CONFIG_HOME:-${HOME}/.config}/neofetch/config" diff --git a/neofetch b/neofetch index ec2ecf60..e8cb0cb5 100755 --- a/neofetch +++ b/neofetch @@ -1658,8 +1658,8 @@ get_term_font() { ;; "termite") - [[ -f "${XDG_CONFIG_HOME}/termite/config" ]] && config_file="${XDG_CONFIG_HOME}/termite/config" - term_font="$(awk -F '= ' '/\[options\]/ {opt=1} /^font/ {if(opt==1) a=$2; opt=0} END{print a}' "/etc/xdg/termite/config" "$config_file")" + [[ -f "${XDG_CONFIG_HOME}/termite/config" ]] && termite_config="${XDG_CONFIG_HOME}/termite/config" + term_font="$(awk -F '= ' '/\[options\]/ {opt=1} /^font/ {if(opt==1) a=$2; opt=0} END{print a}' "/etc/xdg/termite/config" "$termite_config")" ;; "urxvt" | "urxvtd" | "rxvt-unicode" | "xterm") @@ -3979,8 +3979,8 @@ get_args() { # Other "--config") case "$2" in - "none" | "off" | "") config="off" ;; - *) config_file="$2"; config="on"; get_user_config 2>/dev/null ;; + "none" | "off" | "") ;; + *) config_file="$2"; get_user_config 2>/dev/null ;; esac ;; "-v") verbose="on" ;; From a4fec94cc70f5090bafce98c2986b32cb2a06d40 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 15 Jan 2017 09:44:56 +1100 Subject: [PATCH 27/31] Image: [Shuffle] Fixed issues with shuffle mode --- neofetch | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/neofetch b/neofetch index e8cb0cb5..c50d5542 100755 --- a/neofetch +++ b/neofetch @@ -2058,8 +2058,10 @@ get_image_source() { *) if [[ -d "$image_source" ]]; then + shopt -s nullglob files=("${image_source%/}"/*.{png,jpg,jpeg,jpe,gif}) - printf -v image "%s" "${files[RANDOM % (${#files[@]} - 1)]}" + shopt -u nullglob + image="${files[RANDOM % ${#files[@]}]}" else image="$image_source" From faf2d3382e15d7d33b2585f1cfbb6424925fdd9b Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 15 Jan 2017 12:21:44 +1100 Subject: [PATCH 28/31] Config: Fix missing newline --- config/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/config b/config/config index 4fc14ef9..1ae781a0 100644 --- a/config/config +++ b/config/config @@ -710,4 +710,4 @@ image_host="teknik" # # NOTE: Don't change this value, neofetch reads this to determine # how to handle backwards compatibility. -config_version="2.1.0" \ No newline at end of file +config_version="2.1.0" From a3b26d131bc7fae8a789e74abc01cce4b1bafb91 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Tue, 17 Jan 2017 14:52:25 +1100 Subject: [PATCH 29/31] Args: Rename --image_{source,backend} to {source,backend} --- neofetch | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/neofetch b/neofetch index 52e37595..fd0015a7 100755 --- a/neofetch +++ b/neofetch @@ -3918,16 +3918,15 @@ get_args() { "--disk_display") disk_display="$2" ;; # Image backend - "--image_backend") image_backend="$2" ;; - "--image_source") image_source="$2" ;; - "--ascii") image_backend="ascii" ;; - "--caca") image_backend="caca" ;; - "--catimg") image_backend="catimg" ;; - "--jp2a") image_backend="jp2a" ;; - "--iterm2") image_backend="iterm2" ;; - "--off") image_backend="off" ;; - "--tycat") image_backend="tycat" ;; - "--w3m") image_backend="w3m" ;; + "--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" ;; From 232d7d5e4ffdc69d8c038b747f4545ce45a55af0 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Tue, 17 Jan 2017 14:59:57 +1100 Subject: [PATCH 30/31] Docs: Add new arg info --- neofetch | 18 ++++++++++-------- neofetch.1 | 26 ++++++++++++++------------ 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/neofetch b/neofetch index fd0015a7..25245bf1 100755 --- a/neofetch +++ b/neofetch @@ -3712,17 +3712,19 @@ BARS: Possible values: bar, infobar, barinfo, off IMAGE BACKEND: - --image_backend backend Which image backend to use. + --backend backend Which image backend to use. Possible values: 'ascii', 'caca', 'catimg', 'jp2a', 'iterm2', 'off', 'tycat', 'w3m' - --image_source source Which image or ascii file to use. + --source source Which image or ascii file to use. Possible values: 'auto', 'ascii', 'wallpaper', '/path/to/img', '/path/to/ascii', '/path/to/dir/' - --ascii Shortcut to use 'ascii' backend. - --caca Shortcut to use 'caca' backend. - --catimg Shortcut to use 'catimg' backend. - --iterm2 Shortcut to use 'iterm2' backend. + --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. - --tycat Shortcut to use 'tycat' backend. - --w3m Shortcut to use 'w3m' backend. + + NOTE: 'source; can be any of the following: 'auto', 'ascii', 'wallpaper', '/path/to/img', '/path/to/ascii', '/path/to/dir/' ASCII: --ascii_colors x x x x x x Colors to print the ascii art diff --git a/neofetch.1 b/neofetch.1 index 7f35f164..f78b53ef 100644 --- a/neofetch.1 +++ b/neofetch.1 @@ -173,34 +173,36 @@ Bar mode. Possible values: bar, infobar, barinfo, off .SS "IMAGE BACKEND:" .TP -\fB\-\-image_backend\fR backend +\fB\-\-backend\fR backend Which image backend to use. Possible values: 'ascii', 'caca', 'catimg', 'jp2a', 'iterm2', 'off', 'tycat', 'w3m' .TP -\fB\-\-image_source\fR source +\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 -Shortcut to use 'ascii' backend. +source Shortcut to use 'ascii' backend. .TP \fB\-\-caca\fR -Shortcut to use 'caca' backend. +source Shortcut to use 'caca' backend. .TP \fB\-\-catimg\fR -Shortcut to use 'catimg' backend. +source Shortcut to use 'catimg' backend. .TP \fB\-\-iterm2\fR -Shortcut to use 'iterm2' backend. +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. -.TP -\fB\-\-tycat\fR -Shortcut to use 'tycat' backend. -.TP -\fB\-\-w3m\fR -Shortcut to use 'w3m' 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 From 71b35b57ef4fe4cf960189c94d30f65a78ef220c Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Tue, 17 Jan 2017 15:02:24 +1100 Subject: [PATCH 31/31] Config: Update docs --- config/config | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/config b/config/config index 4fc14ef9..37907b80 100644 --- a/config/config +++ b/config/config @@ -530,7 +530,7 @@ disk_display="off" # # Default: 'ascii' # Values: 'ascii', 'caca', 'catimg', 'jp2a', 'iterm2', 'off', 'tycat', 'w3m' -# Flag: --image_backend +# Flag: --backend image_backend="ascii" # Image Source @@ -539,7 +539,7 @@ image_backend="ascii" # # Default: 'auto' # Values: 'auto', 'ascii', 'wallpaper', '/path/to/img', '/path/to/ascii', '/path/to/dir/' -# Flag: --image_source +# 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 @@ -710,4 +710,4 @@ image_host="teknik" # # NOTE: Don't change this value, neofetch reads this to determine # how to handle backwards compatibility. -config_version="2.1.0" \ No newline at end of file +config_version="2.1.0"