From 1c2569327f68d536cfa76efe35ff58b13e33c8b6 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 14 Jan 2017 20:59:12 +1100 Subject: [PATCH 01/15] 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!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u)OD}>Dld$Q|w7lo-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& 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 02/15] 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 zz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BbZsj8*(@47+{+=G5K<=IK<6Yl-%v#Z*%}7^({tzL z^Ond6BHOER%)|6{_W;!vsl1Ob9?N(oA}4_ES$84rD6gSOU5#+vHl2ezTmb45&OCWf zWgih!$;27yO^IB$ahJFu0bl<-< zI)Au?X+Xzlp!H69`j2!Zd7z^%olF8-0C^pu$usSJ*f@K;j|5 zscc2_v+zSu*zsIExkwu)OD}>Dld$Q|w7lo-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 03/15] 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 04/15] 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 05/15] 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 06/15] 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 07/15] 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 08/15] 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 09/15] 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 10/15] 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 11/15] 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 12/15] 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 13/15] 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 14/15] 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 15/15] 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