From cdec06ee5a01d7d0eea3b743478c0985364fb399 Mon Sep 17 00:00:00 2001 From: Michael Carlberg Date: Wed, 14 Dec 2016 17:19:32 +0100 Subject: [PATCH] fix(tray): Remove default disable warning --- src/x11/tray_manager.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/x11/tray_manager.cpp b/src/x11/tray_manager.cpp index efd8ceeb..540c1791 100644 --- a/src/x11/tray_manager.cpp +++ b/src/x11/tray_manager.cpp @@ -66,21 +66,21 @@ tray_manager::~tray_manager() { void tray_manager::setup(const bar_settings& bar_opts) { auto conf = config::make(); auto bs = conf.section(); - auto tray_position = conf.get(bs, "tray-position", ""); - if (tray_position == "left") { - m_opts.align = alignment::LEFT; - } 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 (!conf.has(bs, "tray-position")) { + return m_log.info("Disabling tray manager (reason: missing `tray-position`)"); } - if (m_opts.align == alignment::NONE) { - m_log.warn("Disabling tray manager (reason: position not set or invalid)"); - return; + auto position = conf.get(bs, "tray-position"); + + 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(bs, "tray-detached", false);