2022-04-15 17:50:04 -04:00
|
|
|
#include "modules/tray.hpp"
|
|
|
|
|
|
|
|
#include "modules/meta/base.inl"
|
2022-08-28 09:15:48 -04:00
|
|
|
#include "x11/background_manager.hpp"
|
2022-04-15 17:50:04 -04:00
|
|
|
|
|
|
|
POLYBAR_NS
|
|
|
|
namespace modules {
|
|
|
|
template class module<tray_module>;
|
|
|
|
|
|
|
|
tray_module::tray_module(const bar_settings& bar_settings, string name_)
|
2022-08-28 09:15:48 -04:00
|
|
|
: static_module<tray_module>(bar_settings, move(name_))
|
2022-09-03 15:33:22 -04:00
|
|
|
, m_tray(connection::make(), signal_emitter::make(), m_log, bar_settings, [&] { this->broadcast(); }) {
|
2022-04-15 17:50:04 -04:00
|
|
|
m_formatter->add(DEFAULT_FORMAT, TAG_TRAY, {TAG_TRAY});
|
|
|
|
}
|
|
|
|
|
|
|
|
string tray_module::get_format() const {
|
|
|
|
return DEFAULT_FORMAT;
|
|
|
|
}
|
|
|
|
|
2022-08-28 09:15:48 -04:00
|
|
|
void tray_module::start() {
|
2022-09-03 14:56:32 -04:00
|
|
|
m_tray.setup(m_conf, name());
|
2022-08-28 09:15:48 -04:00
|
|
|
this->static_module<tray_module>::start();
|
|
|
|
}
|
|
|
|
|
2022-04-15 17:50:04 -04:00
|
|
|
bool tray_module::build(builder* builder, const string& tag) const {
|
|
|
|
if (tag == TAG_TRAY) {
|
|
|
|
builder->control(tags::controltag::t);
|
2022-08-28 09:29:36 -04:00
|
|
|
extent_val offset_extent = {extent_type::PIXEL, static_cast<float>(m_tray.get_width())};
|
2022-04-15 17:50:04 -04:00
|
|
|
builder->offset(offset_extent);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2022-08-28 09:15:48 -04:00
|
|
|
} // namespace modules
|
2022-04-15 17:50:04 -04:00
|
|
|
POLYBAR_NS_END
|