mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
Merge branch 'master' into clean
This commit is contained in:
commit
c621afb0c4
@ -11,6 +11,7 @@ waybar::modules::Memory::Memory(const std::string& id, const Json::Value& config
|
|||||||
auto waybar::modules::Memory::update() -> void {
|
auto waybar::modules::Memory::update() -> void {
|
||||||
parseMeminfo();
|
parseMeminfo();
|
||||||
if (memtotal_ > 0 && memfree_ >= 0) {
|
if (memtotal_ > 0 && memfree_ >= 0) {
|
||||||
|
auto total_ram_gigabytes = memtotal_ / std::pow(1024, 2);
|
||||||
int used_ram_percentage = 100 * (memtotal_ - memfree_) / memtotal_;
|
int used_ram_percentage = 100 * (memtotal_ - memfree_) / memtotal_;
|
||||||
auto used_ram_gigabytes = (memtotal_ - memfree_) / std::pow(1024, 2);
|
auto used_ram_gigabytes = (memtotal_ - memfree_) / std::pow(1024, 2);
|
||||||
auto available_ram_gigabytes = memfree_ / std::pow(1024, 2);
|
auto available_ram_gigabytes = memfree_ / std::pow(1024, 2);
|
||||||
@ -18,6 +19,7 @@ auto waybar::modules::Memory::update() -> void {
|
|||||||
getState(used_ram_percentage);
|
getState(used_ram_percentage);
|
||||||
label_.set_markup(fmt::format(format_,
|
label_.set_markup(fmt::format(format_,
|
||||||
used_ram_percentage,
|
used_ram_percentage,
|
||||||
|
fmt::arg("total", total_ram_gigabytes),
|
||||||
fmt::arg("percentage", used_ram_percentage),
|
fmt::arg("percentage", used_ram_percentage),
|
||||||
fmt::arg("used", used_ram_gigabytes),
|
fmt::arg("used", used_ram_gigabytes),
|
||||||
fmt::arg("avail", available_ram_gigabytes)));
|
fmt::arg("avail", available_ram_gigabytes)));
|
||||||
|
Loading…
Reference in New Issue
Block a user