mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
feat: basic config file
This commit is contained in:
@ -5,15 +5,20 @@ waybar::modules::Memory::Memory()
|
||||
{
|
||||
_label.get_style_context()->add_class("memory");
|
||||
_thread = [this] {
|
||||
struct sysinfo info;
|
||||
if (!sysinfo(&info)) {
|
||||
double available = (double)info.freeram / (double)info.totalram;
|
||||
_label.set_text(fmt::format("{:.{}f}% ", available * 100, 0));
|
||||
}
|
||||
update();
|
||||
_thread.sleep_for(chrono::seconds(30));
|
||||
};
|
||||
};
|
||||
|
||||
auto waybar::modules::Memory::update() -> void
|
||||
{
|
||||
struct sysinfo info;
|
||||
if (!sysinfo(&info)) {
|
||||
double available = (double)info.freeram / (double)info.totalram;
|
||||
_label.set_text(fmt::format("{:.{}f}% ", available * 100, 0));
|
||||
}
|
||||
}
|
||||
|
||||
waybar::modules::Memory::operator Gtk::Widget &() {
|
||||
return _label;
|
||||
}
|
||||
|
Reference in New Issue
Block a user