From b8917e99732e0cd75d5c9a7746c15dc26c862df7 Mon Sep 17 00:00:00 2001 From: Alexis Date: Thu, 9 Aug 2018 14:34:39 +0200 Subject: [PATCH] feat(config): interval for cpu and memory modules --- src/modules/cpu.cpp | 3 ++- src/modules/memory.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/modules/cpu.cpp b/src/modules/cpu.cpp index 20e117b..b953a4f 100644 --- a/src/modules/cpu.cpp +++ b/src/modules/cpu.cpp @@ -7,7 +7,8 @@ waybar::modules::Cpu::Cpu(Json::Value config) _label.get_style_context()->add_class("cpu"); _thread = [this] { update(); - _thread.sleep_for(chrono::seconds(10)); + int interval = _config["interval"] ? _config["inveral"].asInt() : 10; + _thread.sleep_for(chrono::seconds(interval)); }; }; diff --git a/src/modules/memory.cpp b/src/modules/memory.cpp index bb981f4..856bd28 100644 --- a/src/modules/memory.cpp +++ b/src/modules/memory.cpp @@ -7,7 +7,8 @@ waybar::modules::Memory::Memory(Json::Value config) _label.get_style_context()->add_class("memory"); _thread = [this] { update(); - _thread.sleep_for(chrono::seconds(30)); + int interval = _config["interval"] ? _config["inveral"].asInt() : 30; + _thread.sleep_for(chrono::seconds(interval)); }; };