1
0
Fork 0
mirror of https://github.com/polybar/polybar.git synced 2024-10-27 05:23:39 -04:00
polybar/include/modules/meta/static_module.hpp
Patrick Ziegler abd96eb089
Enable module in start funcion (#2538)
Before it was enabled by default. That means if the constructor fails,
the destructor will complain that the module was not stopped before
deconstructing.

We can't just call stop if module creation fails because the module is
only partially initialized.
2021-10-15 10:33:10 +02:00

25 lines
442 B
C++

#pragma once
#include "modules/meta/base.hpp"
POLYBAR_NS
namespace modules {
template <class Impl>
class static_module : public module<Impl> {
public:
using module<Impl>::module;
void start() override {
this->module<Impl>::start();
CAST_MOD(Impl)->update();
CAST_MOD(Impl)->broadcast();
}
bool build(builder*, string) const {
return true;
}
};
} // namespace modules
POLYBAR_NS_END