neofetch
neofetch copied to clipboard
Color_block isnt functioning on Debian
Description
No color_block any more, on Debian (GNU/Linux bookworm/sid x86_64)
Verbose log..
"neofetch -v" returns: /usr/bin/neofetch: line 3803: bad substitution: no closing `}' in ${block_spaces// /${blocks}nl}
"bash --version" returns: GNU bash, version 5.2.0(1)-rc2 (x86_64-pc-linux-gnu)
Maybe linked to this version of bash. I have this issue too on a Debian VM (5.2.0(1)-rc2) and a KaliLinux VM (5.2.0(1)-rc2), but not on a Ubuntu VM (5.1.16(1)-release) nor my host, a Gentoo (5.1.16(1)-release).
This issue affects Ubuntu Kinetic as well.
Reproduced with Ubuntu Kinetic and Debian testing/sid:
- GNU bash, version 5.2.0(1)-rc2 (aarch64-unknown-linux-gnu)
This fixed the issue for me:
$ git diff neofetch| cat -A
diff --git a/neofetch b/neofetch$
index 48b96d21..d42cc3ea 100755$
--- a/neofetch$
+++ b/neofetch$
@@ -3982,8 +3982,8 @@ get_cols() {$
printf -v block_spaces "%${block_height}s"$
$
# Convert the spaces into rows of blocks.$
- [[ "$blocks" ]] && cols+="${block_spaces// /${blocks}^[[mnl}"$
- [[ "$blocks2" ]] && cols+="${block_spaces// /${blocks2}^[[mnl}"$
+ [[ "$blocks" ]] && cols+="${block_spaces// /${blocks}^[\[mnl}"$
+ [[ "$blocks2" ]] && cols+="${block_spaces// /${blocks2}^[\[mnl}"$
$
# Add newlines to the string.$
cols=${cols%%nl}$
I also suddenly started having this exact issue on mac (installed w/ homebrew) but @bencollerson's fix works :D
This fixed the issue for me:
$ git diff neofetch| cat -A diff --git a/neofetch b/neofetch$ index 48b96d21..d42cc3ea 100755$ --- a/neofetch$ +++ b/neofetch$ @@ -3982,8 +3982,8 @@ get_cols() {$ printf -v block_spaces "%${block_height}s"$ $ # Convert the spaces into rows of blocks.$ - [[ "$blocks" ]] && cols+="${block_spaces// /${blocks}^[[mnl}"$ - [[ "$blocks2" ]] && cols+="${block_spaces// /${blocks2}^[[mnl}"$ + [[ "$blocks" ]] && cols+="${block_spaces// /${blocks}^[\[mnl}"$ + [[ "$blocks2" ]] && cols+="${block_spaces// /${blocks2}^[\[mnl}"$ $ # Add newlines to the string.$ cols=${cols%%nl}$
Works in Termux, thanks a lot.
fedora
tips w/ bash 5.2.2(1)
has same issue, and by adding backslash \
before each [mnl]
as mentioned above fixes it.
Seems similar to #2209
I had the same issues with color blocks on openSUSE tumbleweed which did not appear colors with the last version of bash. Used @bencollerson code that fixed thanks, but now the last white color appears in triple to me.
view here
Shell› bash 5.2.2
Possibly dependent on your colorscheme, I'm using TW also [GNU bash, version 5.2.2(1)-release (x86_64-suse-linux)
] and see the following:
Thanks for your check sbradnick, I'm afraid it's a block configuration issue that add extra blocks more then a colorscheme. I changed colors from Konsole profile, but it seems clear to me that there are two more blocks on the white end.
Solarized
Apparently, this matter remains on my part, i have to look at it if can i fix in a way. I'm using neofetch from direct bash link not from tumbleweed repository also run it from home/user/.config/neofetch/* for both neofetch+config.conf.
I'm using git master as well (not simply 7.1.0-1.9
from "Main Repository (OSS)") rolling my own more-updated version RPM w/ a few tweaks [not related to color_block]; so it wouldn't appear to be an issue w/ TW or the version of bash present in TW.
I downloaded "neofetch" from the git repo, made the edit to have color_block work again and ran "Solarized Dark" in kitty (I usually use st
from suckless.org w/ Dracula theme), no issue(s).
Here's the related settings from my ~/.config/neofetch/config.conf:
# Color Blocks
block_range=(0 15)
color_blocks="on"
block_width=3
block_height=1
col_offset="auto"
I'm using same git master too, The only one I missed.
block_range=(0 15)
Added, the others color/block I had same as yours.
This is my config.conf
ascii_bold="on"
ascii_colors=(4 6 1 8 8 6)
block_range=(0 15)
block_width=3
block_height=1
bar_char_elapsed="-"
bar_char_total="="
bar_border="on"
bar_length=15
bar_color_elapsed="distro"
bar_color_total="distro"
background_color=
battery_display="off"
cpu_brand="on"
cpu_speed="on"
cpu_cores="logical"
cpu_temp="C"
color_blocks="on"
col_offset="auto"
crop_mode="normal"
crop_offset="center"
colors=(distro)
cpu_display="off"
distro_shorthand="on"
de_version="on"
disk_subtitle="dir"
disk_percent="on"
disk_display="off"
gtk_shorthand="off"
gtk2="off"
gtk3="on"
gpu_type="all"
gap=3
ind="$(stat -c %w / | cut -b 1-16)"
image_source="auto"
image_loop="off"
image_size="auto"
kernel_shorthand="on"
memory_percent="on"
memory_unit="mib"
music_player="auto"
mpc_args=()
memory_display="off"
os_arch="on"
uptime_shorthand="off"
package_managers="on"
public_ip_host="http://ident.me"
public_ip_timeout=2
refresh_rate="on"
shell_path="off"
shell_version="on"
separator="›"
song_format="%artist% - %title%"
stdout="off"
title_fqdn="off"
thumbnail_dir="${XDG_CACHE_HOME:-${HOME}/.cache}/thumbnails/neofetch"
underline_enabled="on"
underline_char="¨"
xoffset=0
yoffset=0
This is color/block parts from neofetch
get_cols() {
local blocks blocks2 cols
if [[ "$color_blocks" == "on" ]]; then
# Convert the width to space chars.
printf -v block_width "%${block_width}s"
# Generate the string.
for ((block_range[0]; block_range[0]<=block_range[1]; block_range[0]++)); do
case ${block_range[0]} in
[0-7])
printf -v blocks '%b\e[3%bm\e[4%bm%b' \
"$blocks" "${block_range[0]}" "${block_range[0]}" "$block_width"
;;
*)
printf -v blocks2 '%b\e[38;5;%bm\e[48;5;%bm%b' \
"$blocks2" "${block_range[0]}" "${block_range[0]}" "$block_width"
;;
esac
done
# Convert height into spaces.
printf -v block_spaces "%${block_height}s"
# Convert the spaces into rows of blocks.
[[ "$blocks" ]] && cols+="${block_spaces// /${blocks}^[\[mnl}"
[[ "$blocks2" ]] && cols+="${block_spaces// /${blocks2}^[\[mnl}"
# Add newlines to the string.
cols=${cols%%nl}
cols=${cols//nl/
[${text_padding}C${zws}}
# Add block height to info height.
((info_height+=block_range[1]>7?block_height+2:block_height+1))
case $col_offset in
"auto") printf '\n\e[%bC%b\n' "$text_padding" "${zws}${cols}" ;;
*) printf '\n\e[%bC%b\n' "$col_offset" "${zws}${cols}" ;;
esac
fi
unset -v blocks blocks2 cols
# Tell info() that we printed manually.
prin=1
}
I'm investigating it, but I haven't been able to bring it up properly so far, i'm using one of r0xANDt0l/neofetch-themes. https://github.com/r0xANDt0l/neofetch-themes Exactly Boxes https://raw.githubusercontent.com/Chick2D/neofetch-themes/main/normal/boxes.conf Something to notice: #Colour config is here and in .zshrc while i'm using bash.
Odd. I checked out https://github.com/r0xANDt0l/neofetch-themes and downloaded 'boxes' then ran neofetch --config boxes.conf
and it behaves as I'd expect regarding colors. Same with 'onrefetch'.
Thank you very much for your help sbradnick. Apparently, this is completely my concern then i have to check it myself where it lies.
Sorry 2f2a for exaggerating your topic.
The column cutoff issue on Bash ≥5.2 is fixed in HyFetch 1.4.3 / neowofetch 7.3.3 by the pull request https://github.com/hykilpikonna/hyfetch/pull/24.

HyFetch is a fork of neofetch with LGBTQ pride flags, but the repo also maintains an updated version of the original neofetch, addressing many pull requests that are not merged in the original repo.
Read the "Running Updated Original Neofetch" section for more info!
It is a bug of Bash 5.2. Bash 5.2.4 has fixed it.
Debian has packaged Bash 5.2.15-2 and accepted it into testing ("Bookworm") and unstable ("Sid") recently. If you are using these Debian suites, upgrade your Bash installation.
Ubuntu is a package thief. It steals packages from Debian unstable ("Sid") constantly. So they rarely do anything until Debian packaged a new version that fixed the issue. That's exactly what this case is. For now, Bash 5.2.15-2 has been stolen from Debian, patched with Ubuntu-specific patches, and entered the proposed
repository of "Lunar Lobster". Probably in a few days, it will enter the main
repository of "Lunar Lobster", and some extra days after that it should be able to enter the "Kinetic Kudu" repository.