dylanaraps / neofetch

🖼️ A command-line system information tool written in bash 3.2+
MIT License
22.18k stars 1.66k forks source link

Images not displaying #1045

Closed filipekiss closed 6 years ago

filipekiss commented 6 years ago

Description

I've updated my config to use an image instead of the ascii art but it's not working. If I don't pass any parameters, it will use the ascii art and if I pass, for example, --imgcat --source /path/to/img it breaks. iTerm is ok with the images because imgcat works as expected. I've also tried running neofetch under bash instead of zsh but the result is the same.

Neofetch version

Neofetch 5.0.0 OS: macOS High Sierra 10.13.5 17F77 Host: MacBookPro14,1 Shell: zsh 5.5.1 Terminal: iTerm2

Screenshot

If i run neofetch with no arguments:

image

If I pass --imgcat --source $HOME/neofetch.png it hangs for a while at this screen:

image

Then this flashes: image and then the screen is cleared

Config file

https://gist.github.com/filipekiss/39c459ba4d7b9703b3a11f306a1a8533#file-config-conf

Verbose log

https://gist.github.com/filipekiss/39c459ba4d7b9703b3a11f306a1a8533#file-neofetch-log

onedr0p commented 6 years ago

Same issue here, I am on 5.0.1. I installed with brew install neofetch --HEAD

However, I am using iterm2 as the backend. The imgcat command shows the picture just fine.

MindTooth commented 6 years ago

Well, I don't think there is a --imgcat option.

Tried with neofetch --iterm2 $HOME/neofetch.png?

sharkytowers commented 6 years ago

I had the same issue on arch/arcolinux. I rolled back to the version of neofetch that is on the aur (as opposed to the one in the repo it (arcolinux) wants to update) and it works. Hope that helps someone.

filipekiss commented 6 years ago

@MindTooth yeah, the result is the same :/

@sharkytowers I'll try the previous version! Thanks

sharkytowers commented 6 years ago

@filipekiss I think I have version 3.3.0-1 which I know is old, but it is working for me. I did a makefile after cloning whatever was on the AUR

erikdubois commented 6 years ago

I can confirm this is a problem and narrow it down for you.

If you update to the latest version of neofetch on Arch 5.0.0-1 and use config.conf the images do NOT work. If you rename the same config.conf to config the images WILL display.

Something in the renaming of the file has gone wrong.

Using the naming convention config.conf

arcolinux-neofetch_2018-06-28_10-39-42

Using the same code but naming convention config.

arcolinux-neofetch-config_2018-06-28_10-46-19

filipekiss commented 6 years ago

@erikdubois I'm running macOS and tried this, but did not work :( I still get the weird binary dump.

erikdubois commented 6 years ago

Make sure that none of the images are being used. All hashtags before them. Backend should be ascii

StarryTony commented 6 years ago

Hi, I have created a pull request to fix this. However, you can manually add "unset IFS" to the function:

get_window_size(){

    IFS=';t' read -d t -t 1 -sra term_size
    unset IFS

}

@filipekiss you may try this. enjoy!

Notice: If you have a old version bash, change the timeout option to 1 (because old version can not support 0.05 as timeout option) as in my code. (Sorry forgot mentioning this)

2018-06-30-09_59_50_copy

erikdubois commented 6 years ago

I have added this line to the variables at the top

config_file="${XDG_CONFIG_HOME}/neofetch/config.conf"

and then the image shows. Can it be that the variable is empty when first used?

StarryTony commented 6 years ago

@erikdubois I debugged on MacOS and found the issue is caused by empty assigned variables because the IFS is not unset after usage.

erikdubois commented 6 years ago

The variable I mentioned up there. It works here now.

filipekiss commented 6 years ago

Hey @StarryTony, thank you for your time. That still doesn't work for me =(

I'll keep fiddling around and see if I can find what's causing this.

StarryTony commented 6 years ago

@filipekiss For my MacOS (the same version but with zsh 5.3, iterm2), I found it caused by null windows size and had the same error output. The solution works for me. You may try -vv option to get a full diagnosis information. Hope it helps.

iwestlin commented 6 years ago

I have same issue on macOS and found it also caused by null windows size. But adding unset IFS did not solve it, after some debugging I found out the reason and the solution for me. It turns out that macOS is using bash version 3.2.57 which did not support read -t 0.05 option. so I just changed IFS=';t' read -d t -t 0.05 -sra term_size to IFS=';t' read -d t -sra term_size and it worked!

For those who still have the problem, there is another way: update bash to the newest version. For macOS user is: brew install bash then add #!/usr/local/bin/bash to the first line of neofetch(which locates at /usr/local/bin/neofetch).

StarryTony commented 6 years ago

Oh sorry to forget mentioning that if you have an old version of bash, you probably change the timeout option to 1 because it cannot support 0.05. My code has changed that but I forgot mentioning that. I am using bash 3.2 for the neofetch too.

filipekiss commented 6 years ago

Updating bash version was the solution! Thank you @StarryTony! (Just updated it, didn't even need to change the shebang nor the IFS!)

StarryTony commented 6 years ago

Congrats!

onedr0p commented 6 years ago

Just installing bash brew install bash worked for me.

thilaire commented 6 years ago

Thanks !

I am using zsh 5.6.2 on a fresh High Sierra Mac OS, and the image did not displayed. I changed the timeout of the read (in the get_window_size function) and it works !!! So I changed IFS=';t' read -d t -t 0.05 -sra term_size into IFS=';t' read -d t -t 1 -sra term_size and everything is fine, now

Thanks again !!

davidmrdavid commented 5 years ago

Hey folks, I'm a little confused about this. I'm using Bash 4.4 and iterm2 on MacOS Sierra. I tried adding get_window_size with little success. Whats the expected ~/.config/neofetch/config.conf to get this working?