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,16 +5,21 @@ waybar::modules::Cpu::Cpu()
{
_label.get_style_context()->add_class("cpu");
_thread = [this] {
struct sysinfo info;
if (!sysinfo(&info)) {
float f_load = 1.f / (1 << SI_LOAD_SHIFT);
_label.set_text(fmt::format("{:.{}f}% ",
info.loads[0] * f_load * 100 / get_nprocs(), 0));
}
update();
_thread.sleep_for(chrono::seconds(10));
};
};
auto waybar::modules::Cpu::update() -> void
{
struct sysinfo info;
if (!sysinfo(&info)) {
float f_load = 1.f / (1 << SI_LOAD_SHIFT);
_label.set_text(fmt::format("{:.{}f}% ",
info.loads[0] * f_load * 100 / get_nprocs(), 0));
}
}
waybar::modules::Cpu::operator Gtk::Widget &() {
return _label;
}