1
0
Fork 0
mirror of https://github.com/polybar/polybar.git synced 2024-11-11 13:50:56 -05:00
polybar/src/modules/tray.cpp

37 lines
1 KiB
C++
Raw Normal View History

#include "modules/tray.hpp"
#include "modules/meta/base.inl"
2022-08-28 09:15:48 -04:00
#include "x11/background_manager.hpp"
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(); }) {
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() {
m_tray.setup(m_conf, name());
2022-08-28 09:15:48 -04:00
this->static_module<tray_module>::start();
}
bool tray_module::build(builder* builder, const string& tag) const {
if (tag == TAG_TRAY) {
builder->control(tags::controltag::t);
extent_val offset_extent = {extent_type::PIXEL, static_cast<float>(m_tray.get_width())};
builder->offset(offset_extent);
return true;
}
return false;
}
2022-08-28 09:15:48 -04:00
} // namespace modules
POLYBAR_NS_END