fix(tray): Remove default disable warning

This commit is contained in:
Michael Carlberg 2016-12-14 17:19:32 +01:00
parent 4870204b4f
commit cdec06ee5a

View File

@ -66,21 +66,21 @@ tray_manager::~tray_manager() {
void tray_manager::setup(const bar_settings& bar_opts) { void tray_manager::setup(const bar_settings& bar_opts) {
auto conf = config::make(); auto conf = config::make();
auto bs = conf.section(); auto bs = conf.section();
auto tray_position = conf.get<string>(bs, "tray-position", "");
if (tray_position == "left") { if (!conf.has(bs, "tray-position")) {
m_opts.align = alignment::LEFT; return m_log.info("Disabling tray manager (reason: missing `tray-position`)");
} else if (tray_position == "right") {
m_opts.align = alignment::RIGHT;
} else if (tray_position == "center") {
m_opts.align = alignment::CENTER;
} else {
m_opts.align = alignment::NONE;
} }
if (m_opts.align == alignment::NONE) { auto position = conf.get<string>(bs, "tray-position");
m_log.warn("Disabling tray manager (reason: position not set or invalid)");
return; if (position == "left") {
m_opts.align = alignment::LEFT;
} else if (position == "right") {
m_opts.align = alignment::RIGHT;
} else if (position == "center") {
m_opts.align = alignment::CENTER;
} else {
return m_log.err("Disabling tray manager (reason: Invalid position \"" + position + "\")");
} }
m_opts.detached = conf.get<bool>(bs, "tray-detached", false); m_opts.detached = conf.get<bool>(bs, "tray-detached", false);