Skip to content
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

[module/memory] Display MiB instead of GiB when GiB value is less than 1GiB #2488

Merged
merged 7 commits into from Sep 4, 2021

Conversation

malta895
Copy link
Contributor

@malta895 malta895 commented Sep 3, 2021

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update
  • Other: Replace this with a description of the type of this PR

Description

Memory/swap values can now be displayed in MiB instead of GiB when the value is less than 1 GiB, for better precision.
For example, display 512 MiB instead of 0.50 GiB.

The following tokens have been added to the memory module in order to activate this behavior from config:

;   %used%
;   %free%
;   %total%
;   %swap_total%
;   %swap_free%
;   %swap_used%

Related Issues & Documents

Closes #2472

Documentation (check all applicable)

  • This PR requires changes to the Wiki documentation (describe the changes)
  • This PR requires changes to the documentation inside the git repo (please add them to the PR).
  • Does not require documentation changes

The documentation of the memory module should be updated with the tokens described earlier, and a description on their behavior.

@malta895 malta895 changed the title feat:add tokens to display memory in MiB when GiB val <= 1.0 (#2472) [module/memory] Display MiB instead of GiB when GiB value is less than 1GiB Sep 3, 2021
@codecov
Copy link

codecov bot commented Sep 3, 2021

Codecov Report

Merging #2488 (6663f67) into master (a520fea) will decrease coverage by 0.00%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2488      +/-   ##
==========================================
- Coverage   10.12%   10.11%   -0.01%     
==========================================
  Files         147      147              
  Lines       10188    10198      +10     
==========================================
  Hits         1032     1032              
- Misses       9156     9166      +10     
Flag Coverage Δ
unittests 10.11% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
include/utils/string.hpp 30.76% <ø> (ø)
src/modules/memory.cpp 0.00% <0.00%> (ø)
src/utils/string.cpp 92.30% <0.00%> (-2.94%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a520fea...6663f67. Read the comment docs.

Copy link
Member

@patrick96 patrick96 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice! Thanks a lot for helping out 😃

Please also add these changes to the CHANGELOG.md file in the Added section. Also see the relevant section in CONTRIBUTING.md for more info.

src/utils/string.cpp Outdated Show resolved Hide resolved
src/utils/string.cpp Outdated Show resolved Hide resolved
@malta895
Copy link
Contributor Author

malta895 commented Sep 3, 2021

Please also add these changes to the CHANGELOG.md file in the Added section. Also see the relevant section in CONTRIBUTING.md for more info.

Done! Sorry I missed that part of contributing 😅

CHANGELOG.md Outdated Show resolved Hide resolved
src/modules/memory.cpp Outdated Show resolved Hide resolved
@patrick96
Copy link
Member

Looks good now :)

I also changed some small things myself, will merge this once CI is done.

@patrick96 patrick96 merged commit ddabe3f into polybar:master Sep 4, 2021
@malta895 malta895 deleted the feat-memory-mib-gib branch September 4, 2021 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[module/memory] Display MiB instead of GiB when GiB value is less than 1GiB
2 participants