feat: basic config file

This commit is contained in:
Alexis
2018-08-09 12:05:48 +02:00
parent 4cec0f390b
commit 39a0ae04a8
18 changed files with 176 additions and 61 deletions

View File

@ -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;
}