diff --git a/include/components/bar.hpp b/include/components/bar.hpp index 07722081..76f30b11 100644 --- a/include/components/bar.hpp +++ b/include/components/bar.hpp @@ -36,10 +36,10 @@ class bar : public xpp::event::sink { public: using make_type = unique_ptr; - static make_type make(); + static make_type make(bool only_initialize_values = false); explicit bar(connection&, signal_emitter&, const config&, const logger&, unique_ptr&&, - unique_ptr&&, unique_ptr&&, unique_ptr&&); + unique_ptr&&, unique_ptr&&, unique_ptr&&, bool only_initialize_values); ~bar(); void parse(string&& data) const; diff --git a/src/components/bar.cpp b/src/components/bar.cpp index aca0a601..76c7c71f 100644 --- a/src/components/bar.cpp +++ b/src/components/bar.cpp @@ -35,7 +35,7 @@ using namespace wm_util; /** * Create instance */ -bar::make_type bar::make() { +bar::make_type bar::make(bool only_initialize_values) { // clang-format off return factory_util::unique( connection::make(), @@ -45,7 +45,8 @@ bar::make_type bar::make() { screen::make(), tray_manager::make(), parser::make(), - taskqueue::make()); + taskqueue::make(), + only_initialize_values); // clang-format on } @@ -56,7 +57,7 @@ bar::make_type bar::make() { */ bar::bar(connection& conn, signal_emitter& emitter, const config& config, const logger& logger, unique_ptr&& screen, unique_ptr&& tray_manager, unique_ptr&& parser, - unique_ptr&& taskqueue) + unique_ptr&& taskqueue, bool only_initialize_values) : m_connection(conn) , m_sig(emitter) , m_conf(config) @@ -144,6 +145,10 @@ bar::bar(connection& conn, signal_emitter& emitter, const config& config, const m_opts.separator = string_util::trim(m_conf.get(bs, "separator", ""), '"'); m_opts.locale = m_conf.get(bs, "locale", ""); + if (only_initialize_values) { + return; + } + // Load values used to adjust the struts atom m_opts.strut.top = m_conf.get("global/wm", "margin-top", 0); m_opts.strut.bottom = m_conf.get("global/wm", "margin-bottom", 0); diff --git a/src/main.cpp b/src/main.cpp index fa03d860..06c1e34c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -110,7 +110,7 @@ int main(int argc, char** argv) { return EXIT_SUCCESS; } if (cli->has("print-wmname")) { - std::cout << bar::make()->settings().wmname << std::endl; + std::cout << bar::make(true)->settings().wmname << std::endl; return EXIT_SUCCESS; }