Swap to manually calculating the mem total and usage via procfs. The usage calculation is now:
total - (free + cached + buffers + slab_reclaimable - shmem)
This follows the same usage calculation as htop. See the PR for more details.
Fixes the accuracy of the memory widget for Linux and macOS, and uses binary prefixes instead to be more accurate.
Regarding the first part, it turns out that the way I was calculating memory usage was *slightly* incorrect for a few reasons:
- Regarding macOS, it seems like the way I was determining usage (`usage = total - available`) is not the most accurate. The better way of doing this is apparently `usage = wire + active`, where `wire` is memory always marked to stay in RAM, and `active` is memory currently in RAM. This seems to be much closer to other applications now.
- Regarding Linux, this was somewhat due to two issues - one was that I should have used heim's own built-in function call to get how much memory was *used*, and the other is that when heim reads info from `meminfo`, it reads it in *kilobytes* - however, the values are actually in *kibibytes*. As such, to get the value in kibibytes, you want to actually take it in kilobytes.
While I've filed an issue for the library, for now, I'll just manually bandaid over this. See https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/deployment_guide/s2-proc-meminfo for more info.
Both changes take more advantage of platform-specific methods, and as such, the change unfortunately adds some ugly platform-specific code blocks.
Side note, Windows Task Manager apparently (?) uses binary prefixes for the values behind the scenes, but displays decimal prefixes. As such, now that we've switched to binary prefixes, it'll "seem" like the two aren't matching anymore since the units won't match, despite the values matching.
Adds the missing hide_time and battery config option to the default config and corresponding documentation.
Should probably automate the generation of this somehow tbh, though this might change when I add in-app config (soon™)
Seems like we have a few too many tests that aren't really needed for just asserting CI is passing.
The goal for CI (IMO) is just to ensure things still build on the various supported platforms after changes are made. However, there were a few tested scenarios like Windows GNU or musl which I feel weren't really too important in this regard, and added extra time to an already long CI process.
Commented out the following tests since there aren't any architecture-specific features that require running these in addition to other already-existing tests:
- Windows GNU
- Linux musl (both x86 and x86_64)
Of course, should we add changes that directly affect these architectures, then we should add the tests back.
Small refactor to remove the beef dependency for now.
This is likely just a tempoary change, I wanted to remove it just for clarity's sake among dependencies, and will probably add it back in the future.
For now I'll just stick to std's beef.
This is just a temp change, I wanted to remove it just for clarity's
sake among dependencies, and will probably add it back in the future.
For now I'll just stick to std's beef.