dundee / gdu

Fast disk usage analyzer with console interface written in Go
MIT License
3.96k stars 142 forks source link

How about higher resolution size bar ? #254

Closed yurenchen000 closed 1 year ago

yurenchen000 commented 1 year ago

I noticed that there is already some discussion about size bar:

82

121

I think here is a discussion about another dimension of size bar: the indicator resolution.

0. Current display effect

gdu_bar

You can see 49MB and 24KB has same bar width. // I replaced # with in the screenshot.

Maybe display effect could be better

1. The magic characters

Code Character Width
U+2588 8/8
U+2589 8/7
U+258A 8/6
U+258B 8/5
U+258C 8/4
U+258D 8/3
U+258E 8/2
U+258F 8/1

ref: https://mike42.me/blog/2018-06-make-better-cli-progress-bars-with-unicode-block-characters/amp https://en.wikipedia.org/wiki/Block_Elements

try:


███ -- 24 width
██▉
██▊
██▋
██▌
██▍
██▎
██▏ 
██  -- 16
█▉
█▊
█▋
█▌
█▍
█▎
█▏  
█   -- 8 
▉
▊
▋
▌
▍
▎
▏   -- 1

This makes it possible to obtain higher resolution bars.

How about it?

shortcoming: maybe need mono width font-family in user terminal application.

dundee commented 1 year ago

Very nice idea indeed! Would you like to implement it or should I do it?

dundee commented 1 year ago

Sorry, I couldn't resist 😇

yurenchen000 commented 1 year ago

quick and clean you genius, that's awesome :laughing:

I run the new code as fast as I could, it works perfectly :+1:

dundee commented 1 year ago

I will release new version in the evening. Thanks for great contribution!