Stop ipc_module subclassing static_module

This commit is contained in:
patrick96 2021-09-30 15:11:31 +02:00 committed by Patrick Ziegler
parent f55f584ef7
commit 6b6bcf5080
2 changed files with 8 additions and 3 deletions

View File

@ -12,7 +12,7 @@ namespace modules {
* shell script and the resulting output will be used
* as the module content.
*/
class ipc_module : public static_module<ipc_module> {
class ipc_module : public module<ipc_module> {
public:
/**
* Hook structure that will be fired

View File

@ -14,7 +14,7 @@ namespace modules {
* Load user-defined ipc hooks and
* create formatting tags
*/
ipc_module::ipc_module(const bar_settings& bar, string name_) : static_module<ipc_module>(bar, move(name_)) {
ipc_module::ipc_module(const bar_settings& bar, string name_) : module<ipc_module>(bar, move(name_)) {
m_router->register_action_with_data(EVENT_SEND, &ipc_module::action_send);
size_t index = 0;
@ -56,13 +56,18 @@ namespace modules {
* Start module and run first defined hook if configured to
*/
void ipc_module::start() {
m_mainthread = thread([&] {
m_log.trace("%s: Thread id = %i", this->name(), concurrency_util::thread_id(this_thread::get_id()));
update();
broadcast();
});
if (m_initial) {
// TODO do this in a thread.
auto command = command_util::make_command<output_policy::REDIRECTED>(m_hooks.at(m_initial - 1)->command);
command->exec(false);
command->tail([this](string line) { m_output = line; });
}
static_module::start();
}
/**