fix(bar): Only initialize config values when using --print-wmname
This commit is contained in:
parent
db7aa7c490
commit
f101a303bd
@ -36,10 +36,10 @@ class bar : public xpp::event::sink<evt::button_press, evt::expose, evt::propert
|
||||
public signal_receiver<SIGN_PRIORITY_BAR, sig_ui::tick, sig_ui::shade_window, sig_ui::unshade_window, sig_ui::dim_window> {
|
||||
public:
|
||||
using make_type = unique_ptr<bar>;
|
||||
static make_type make();
|
||||
static make_type make(bool only_initialize_values = false);
|
||||
|
||||
explicit bar(connection&, signal_emitter&, const config&, const logger&, unique_ptr<screen>&&,
|
||||
unique_ptr<tray_manager>&&, unique_ptr<parser>&&, unique_ptr<taskqueue>&&);
|
||||
unique_ptr<tray_manager>&&, unique_ptr<parser>&&, unique_ptr<taskqueue>&&, bool only_initialize_values);
|
||||
~bar();
|
||||
|
||||
void parse(string&& data) const;
|
||||
|
@ -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<bar>(
|
||||
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>&& screen, unique_ptr<tray_manager>&& tray_manager, unique_ptr<parser>&& parser,
|
||||
unique_ptr<taskqueue>&& taskqueue)
|
||||
unique_ptr<taskqueue>&& 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<string>(bs, "separator", ""), '"');
|
||||
m_opts.locale = m_conf.get<string>(bs, "locale", "");
|
||||
|
||||
if (only_initialize_values) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Load values used to adjust the struts atom
|
||||
m_opts.strut.top = m_conf.get<int>("global/wm", "margin-top", 0);
|
||||
m_opts.strut.bottom = m_conf.get<int>("global/wm", "margin-bottom", 0);
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user