diff --git a/include/modules/cmdscript.hpp b/include/modules/cmdscript.hpp deleted file mode 100644 index 3b2d2a5d..00000000 --- a/include/modules/cmdscript.hpp +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "modules/script.hpp" - -POLYBAR_NS - -namespace modules { - class cmdscript_module : virtual public script_module { - public: - explicit cmdscript_module(const bar_settings&, string); - - protected: - void process(); - chrono::duration sleep_duration(); - }; -} - -POLYBAR_NS_END diff --git a/include/modules/meta/base.hpp b/include/modules/meta/base.hpp index 0aa82690..182e59b7 100644 --- a/include/modules/meta/base.hpp +++ b/include/modules/meta/base.hpp @@ -130,7 +130,7 @@ namespace modules { protected: void broadcast(); void idle(); - void sleep(chrono::duration sleep_duration); + void sleep(chrono::duration duration); void wakeup(); string get_format() const; string get_output(); diff --git a/include/modules/meta/factory.hpp b/include/modules/meta/factory.hpp index d412b9fe..8535ba4c 100644 --- a/include/modules/meta/factory.hpp +++ b/include/modules/meta/factory.hpp @@ -5,7 +5,6 @@ #include "modules/backlight.hpp" #include "modules/battery.hpp" #include "modules/bspwm.hpp" -#include "modules/cmdscript.hpp" #include "modules/counter.hpp" #include "modules/cpu.hpp" #include "modules/date.hpp" @@ -18,7 +17,6 @@ #if DEBUG #include "modules/systray.hpp" #endif -#include "modules/tailscript.hpp" #include "modules/temperature.hpp" #include "modules/text.hpp" #include "modules/xbacklight.hpp" @@ -95,11 +93,7 @@ namespace { } else if (name == "custom/text") { return new text_module(bar, move(module_name)); } else if (name == "custom/script") { - if (config::make().get("module/" + module_name, "tail", false)) { - return new tailscript_module(bar, move(module_name)); - } else { - return new cmdscript_module(bar, move(module_name)); - } + return new script_module(bar, move(module_name)); } else if (name == "custom/menu") { return new menu_module(bar, move(module_name)); } else if (name == "custom/ipc") { diff --git a/include/modules/script.hpp b/include/modules/script.hpp index ccfea03e..c1ec50bc 100644 --- a/include/modules/script.hpp +++ b/include/modules/script.hpp @@ -10,21 +10,23 @@ namespace modules { class script_module : public module { public: explicit script_module(const bar_settings&, string); - virtual ~script_module() {} + ~script_module() {} - virtual void start(); - virtual void stop(); + void start(); + void stop(); string get_output(); bool build(builder* builder, const string& tag) const; protected: - virtual void process() = 0; - virtual chrono::duration sleep_duration() = 0; + chrono::duration process(const mutex_wrapper()>>& handler) const; + bool check_condition(); - static constexpr const char* TAG_OUTPUT{""}; + private: static constexpr const char* TAG_LABEL{"