-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature absgraph #24
base: master
Are you sure you want to change the base?
Feature absgraph #24
Conversation
This first commit showcases some basic functionality. It currently only works in text mode and with color disabled. For this to work: - I added an agflag (*a*bsolute *g*raph) which is for now always set to 1 (enabled) - I changed the signature of the print_bar method and their implementations to consume three doubles: the used & total space on this volume as well as the total space on the greatest volume - I added an maxfssize variable alongside the max variable that stores the greatest volume's total space which is calculated whenever the latter is updated (see util.c) Every other impl other than the one in text is simply a stub for now.
I decided to go with -A, it is off by default (default behaviour is the same as before) I also added documentation in the english man page and help text, translated versions still need to add documentation for this as I speak neither french nor dutch :)
For the record, on my server it looks like this:
or in wide mode:
I think it worked out rather nicely. Am going to continue work on the other exports, have a nice evening. |
This comment has been minimized.
This comment has been minimized.
Here is another thing I've noticed (this is with upstream dfc):
Notice how both have 0.0% usage but the first one displays only dashes while the second row shows a single = followed by dashes. This is because the 0.0 % of the first are accurately 0.0000 % while the second one is 0.04 % which gets rounded down on output. I don't know whether that's the desired behaviour. |
Also, I don't have any experience using
Notice the change in the second-to-last-line. Should I commit these two or simply discard those changes? |
|
From what I can see, none of the comparable runtime flags can be set through the rc file, so I guess an option to set this new flag throught the rc file isn't wanted either. |
in absolute graph mode, it is wider than the other bars, so I needed support for flexible graph / bar width. before this commit, the color steps in the absolute summary graph would be on the same level as the ones above but not at the correct percentages, think something like this: sda1 ggggggyyyyrr-- sda2 ggggggy------- sda3 ggggggyy------ sum: ggggggyyyyrrrrrrrrrrrrrrrrr--------------- but it should look like this: ggggggggggggggggggyyyyyyyrr--------------- This issue is fixed in this commit.
d17a5df are the newly generated po files, I still don't know if the changes to them are needed. Discard the commit if not. |
Ready for review @rolinh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR! I think the result is probably good only if there aren't large difference in capacity between the various volumes. I don't think I'd ever use this mode but I have no objection merging this PR.
[] translation of the new options in the help text & man page (I don't speak dutch or french so I can't do this)
I speak French and can take care of the translation later on. There is no need to include the changes to the po files with this PR. The idea is to update the po files before a release only except for adding new translation/missing translation strings.
I see a glitch when using the following options:
$ dfc -sTA
FILESYSTEM TYPE (=) USED FREE (-) %USED AVAILABLE TOTAL MOUNTED ON
dev devtmpfs [- ] 0.0% 31.4G 31.4G /dev
run tmpfs [= ] 0.0% 31.4G 31.4G /run
/dev/nvme1n1p2 ext4 [==========----------] 48.7% 469.5G 915.4G /
tmpfs tmpfs [= ] 0.6% 31.2G 31.4G /dev/shm
tmpfs tmpfs [- ] 0.0% 4.0M 4.0M /sys/fs/cgroup
tmpfs tmpfs [= ] 0.0% 31.4G 31.4G /tmp
/dev/nvme1n1p1 vfat [= ] 0.1% 510.7M 511.0M /efi
tmpfs tmpfs [= ] 0.0% 6.3G 6.3G /run/user/1001
tmpfs tmpfs [= ] 0.0% 6.3G 6.3G /run/user/1000
SUM: [=========---------------]
37.9% 608.0G 1.0T
It looks like the size of the bar for the sum is off. I haven't tested the other export types yet.
@scrouthtv Are you still working on this? |
Here it is. |
Yes, what I reported above:
|
What do you mean by off?
That's why the total bar is bigger than the rest. And I think even in your example, its size is correct. |
Mmh I see. However, the columns after the bar are misaligned. It's probably just because the width of the sum bar is not taken into account to compute the column's width. This should be adjusted. |
Ah, now I've got you. Looks like the 39 in text.c in line 172 is off. I will look into it.
As the columns are always in the same order, the offset I need adds up by
|
Sorry for the slow work, I got drawn away by college stuff, should be done now. |
@scrouthtv Sorry for my late reply. I think there still are issues with alignment of the sum row:
|
If dfc decides at runtime to only display short bars instead of wide bars, because the tty is too narrow, the `max.bar` still indicates `GRAPHBAR_WIDE` but it should be `GRAPHBAR_SHORT`. So for calculating the detail fields offset I am now using the ternary thing instead of `max.bar`. This requires another look into it because currently, the titlebar is off if we are using the `-w` option and the tty is too narrow.
Sorry for my late reply ;) I have a lot going on with college at the moment. I think I finally fixed it:
Here is a bug I noticed: If the tty can only fit normal graph mode, but wide graph mode is passed as a cli parameter, the title bar is also off:
I'd say that this can be fixed by changing the value of |
On #23
This is only a wip, I want to keep track of various things during development. There are still things tbd:
Anyways, here is a very basic version that works in text mode and showcases my idea.