From c205fc898767d4cfb51e1625f1891ff8d0edefab Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 19 Dec 2016 15:02:02 +1100 Subject: [PATCH 01/10] Args: Fix user config being sourced twice --- neofetch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/neofetch b/neofetch index 9892543c..8d480093 100755 --- a/neofetch +++ b/neofetch @@ -3130,8 +3130,8 @@ exit 1 } get_args() { - # Check the commandline flags early for '--config none/off' - [[ "$@" =~ --config\ ?(off|none) ]] || get_user_config 2>/dev/null + # Check the commandline flags early for '--config' + [[ "$@" =~ --config ]] || get_user_config 2>/dev/null while [[ "$1" ]]; do case "$1" in From 1cf49345ff41a9b96dd1b53f5c09a5357b16e0c2 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 19 Dec 2016 15:03:26 +1100 Subject: [PATCH 02/10] Docs: Update Changelog --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c2aac2be..e379bafa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -77,14 +77,14 @@ Neofetch now has an irc channel at `#neofetch` on Freenode. If you have any ques - Rewrote function from scratch. - The function is `40` lines smaller than before and works on all \[1\] versions of `df` we tested on \[2\]. - We only show the `root (/)` partition now. - - Showing a total of all disks only worked on GNU `df` and we had to hardcode different commands for Distros and Operating Systens that used a different `df`. + - Showing a total of all disks only worked on GNU `df` and we had to hardcode different commands for Distros and Operating Systems that used a different `df`. - We're using the same `df` flags across all Operating Systems now. - No more ugly case statements or per distro hardcoding of `df` flags. - Removed all percentage calculation since `df` already provides us with the percentage. - Warn the user if `df` isn't installed. - Fixed broken output if `df` wasn't installed but the function was enabled. -\[1\] The function doesn't work on Haiku since their `df` is wildly non-standard. (The output format and flags are 100% different from all of the other `df` versions floating around.) +\[1\] The function doesn't work on Haiku since their `df` is wildly non-standard. (The output format and flags are 100% different from all of the other `df` versions floating around.) \[2\] Tested on `GNU`, `Busybox`, `BSD`, `Solaris` and `macOS` `df` versions. From 2b94fbfadb0c768a2712c9f57faccccf776f957e Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 19 Dec 2016 15:13:45 +1100 Subject: [PATCH 03/10] General: Fix artifacts and broken block width in TTYs --- neofetch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/neofetch b/neofetch index 8d480093..b9270cbb 100755 --- a/neofetch +++ b/neofetch @@ -1738,7 +1738,7 @@ get_cols() { if [[ "$color_blocks" == "on" ]]; then # Convert the width to space chars. printf -v block_width "%${block_width}s" - block_width="${block_width// /█}" + block_width="${block_width// /.}" # Generate the string. for ((start; start<=end; start++)); do @@ -2364,7 +2364,7 @@ get_underline() { } get_line_break() { - line_break="​ " + line_break="${zws} " # Calculate info height info_height="$((info_height+=1))" From 570b7c358a8d474dc2b871dbc23b7cadcc638610 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 19 Dec 2016 15:15:03 +1100 Subject: [PATCH 04/10] Docs: Update Changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e379bafa..4eb793ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ Neofetch now has an irc channel at `#neofetch` on Freenode. If you have any ques - This removes a lot of duplicate code between `info()` and `prin()`. - Remove `printf` subshells and instead use `printf -v` to declare the variables. - Set fixed `$PATH` in the beginning of the script. +- Fixed artifacts when using line-breaks in TTYs. ## Info @@ -107,6 +108,7 @@ Neofetch now has an irc channel at `#neofetch` on Freenode. If you have any ques **Color Blocks**
- Use start++ instead of adding it manually after case. **[@konimex](https://github.com/konimex)** +- Fixed bug where color blocks wouldn't respect width in TTYs. ## Images From 70a684597a93d04c236a75fa8cb74867f63c0067 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 19 Dec 2016 15:23:20 +1100 Subject: [PATCH 05/10] General: Fix bug with line break --- neofetch | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/neofetch b/neofetch index b9270cbb..5378a049 100755 --- a/neofetch +++ b/neofetch @@ -2364,7 +2364,8 @@ get_underline() { } get_line_break() { - line_break="${zws} " + # Print it directly. + printf "%s\n" "${zws} " # Calculate info height info_height="$((info_height+=1))" From 7276ad3a65bcf40e23c131b5fa6f1d1dda3ceeb8 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 19 Dec 2016 15:25:48 +1100 Subject: [PATCH 06/10] Cols: Bypass info/prin --- neofetch | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/neofetch b/neofetch index 5378a049..d818632d 100755 --- a/neofetch +++ b/neofetch @@ -1738,7 +1738,6 @@ get_cols() { if [[ "$color_blocks" == "on" ]]; then # Convert the width to space chars. printf -v block_width "%${block_width}s" - block_width="${block_width// /.}" # Generate the string. for ((start; start<=end; start++)); do @@ -1759,9 +1758,11 @@ get_cols() { # Add newlines to the string. cols="${cols%%'nl'}" cols="${cols//nl/\\n\\033[${text_padding}C${zws}}" + + printf "%b\n" "\033[${text_padding}C${cols}" fi - unset blocks blocks2 + unset -v blocks blocks2 cols } # IMAGES From 17f3a7acde26ceb0e572e2ca67cbdfecdee4a8d5 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 19 Dec 2016 15:29:39 +1100 Subject: [PATCH 07/10] Cols: Fix spacing issue --- neofetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neofetch b/neofetch index d818632d..3eedd09d 100755 --- a/neofetch +++ b/neofetch @@ -1759,7 +1759,7 @@ get_cols() { cols="${cols%%'nl'}" cols="${cols//nl/\\n\\033[${text_padding}C${zws}}" - printf "%b\n" "\033[${text_padding}C${cols}" + printf "%b\n" "\033[${text_padding}C${zws}${cols}" fi unset -v blocks blocks2 cols From 3205ec0fbc89a6f594db2e2e8d914bdbf52e1395 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 19 Dec 2016 15:56:30 +1100 Subject: [PATCH 08/10] Image: Disable image mode if $DISPLAY is unset, closes #543 --- neofetch | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/neofetch b/neofetch index 3eedd09d..b62a55d0 100755 --- a/neofetch +++ b/neofetch @@ -1770,10 +1770,18 @@ get_cols() { get_image_backend() { # This function determines which image backend to use # by checking for programs and etc. - get_image_program - # 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 # If image source is ascii fallback to ascii if [[ "$image_source" == "ascii" ]]; then From d7e3ccb8813b0246301c227fe95fef8d8c34940c Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 19 Dec 2016 15:58:47 +1100 Subject: [PATCH 09/10] Cols: Correctly calculate height --- neofetch | 1 + 1 file changed, 1 insertion(+) diff --git a/neofetch b/neofetch index b62a55d0..e297f350 100755 --- a/neofetch +++ b/neofetch @@ -1760,6 +1760,7 @@ get_cols() { cols="${cols//nl/\\n\\033[${text_padding}C${zws}}" printf "%b\n" "\033[${text_padding}C${zws}${cols}" + info_height="$((info_height+=block_height+2))" fi unset -v blocks blocks2 cols From 8194e0f89d575007ad7fde0a8d47ab5f0b6370c6 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 19 Dec 2016 16:00:40 +1100 Subject: [PATCH 10/10] Docs: Update Changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4eb793ff..38771d10 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -109,11 +109,13 @@ Neofetch now has an irc channel at `#neofetch` on Freenode. If you have any ques - Use start++ instead of adding it manually after case. **[@konimex](https://github.com/konimex)** - Fixed bug where color blocks wouldn't respect width in TTYs. +- Cursor positioning now takes `$block_height` into account. ## Images - [iTerm2] Fixed blank images. +- Fixed bug where image mode would attempt to run in a TTY. ## Ascii