tassaron / tmux-df

Tmux plugin to show disk space in the statusbar
MIT License
30 stars 1 forks source link

It will cause status bar appearance problem on MacOS #1

Closed suckerSlayer closed 2 years ago

suckerSlayer commented 2 years ago

My df works under terminal, but nothing show when add plugin to status-right.

tassaron commented 2 years ago

Hi! Sorry about your issue. I'll try to address it, but first I have some questions.

1) Did you do Ctrl+B followed by I (the letter i) to fetch and install the plugin? 2) Are you using tmux plugin manager (TPM) or manual install? 3) Are you using other tmux plugins, and do they work fine?

Unfortunately I don't have a Mac to test for myself.

suckerSlayer commented 2 years ago

Thanks for your reply! And yes, I have other plugins installed by TPM, and they basically work fine. I also have tmux-df installed this way. By the way I am using zsh instead of MacOS default bash, not sure it matters or not.

tassaron commented 2 years ago

I did as much research as I could, given that I don't have a Mac myself. The only clue I found is that macOS has an old version of Bash, which probably doesn't support the type of array I used in my script. I tried replacing that array with a different one which might be more compatible with older Bash versions.

Could you try this branch and see if it fixes the problem?

I was able to switch my tmux to this branch by doing the following:

If you don't delete the plugin before changing branches, TPM will silently ignore the change of branch.

I'm also curious what the output of bash --version is for you?

suckerSlayer commented 2 years ago
bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin20)
Copyright (C) 2007 Free Software Foundation, Inc.
tassaron commented 2 years ago

Okay, I believe associative arrays were added in version 4+ so that new branch I made should fix it for you 🤞

suckerSlayer commented 2 years ago
image image

I tried the branch still didn't show the value on statusbar, but It didn't crash all the status bar this time which better than the main branch. Maybe still got anoher compatible issuses some where else. Anyway it's kind of you to check this tiny issue for me, thx!😺

tassaron commented 2 years ago

What is the output of echo "$(df -h | awk '{if ($6 == "/") {print $4}}')"? It's probably returning blank.

What about echo "$(df -h / | awk '{print $4}' | tail -n 1)"? That relies less on awk, so maybe it will work!

suckerSlayer commented 2 years ago

Yes, you're right! echo "$(df -h | awk '{if ($6 == "/") {print $4}}')" returns blank while echo "$(df -h / | awk '{print $4}' | tail -n 1)" return the df result So that is where the problem is

tassaron commented 2 years ago

Yay! Thanks for trying that 👍

I'm away from my computer at the moment but I'll merge a fix into the main branch tonight (8 hours from now)

suckerSlayer commented 2 years ago

Wow! Looking forward to it!