From 68ae7a869a9b4532b15576c5ac195b848552b7e2 Mon Sep 17 00:00:00 2001 From: Vasili Karaev Date: Mon, 27 Aug 2018 07:12:22 +0300 Subject: [PATCH] fix(mpd): Get format-online-{prefix,suffix} explicitly (#1399) --- src/modules/mpd.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/modules/mpd.cpp b/src/modules/mpd.cpp index bdc9a654..1eb529a6 100644 --- a/src/modules/mpd.cpp +++ b/src/modules/mpd.cpp @@ -26,7 +26,9 @@ namespace modules { {TAG_BAR_PROGRESS, TAG_TOGGLE, TAG_TOGGLE_STOP, TAG_LABEL_SONG, TAG_LABEL_TIME, TAG_ICON_RANDOM, TAG_ICON_REPEAT, TAG_ICON_REPEAT_ONE, TAG_ICON_SINGLE, TAG_ICON_PREV, TAG_ICON_STOP, TAG_ICON_PLAY, TAG_ICON_PAUSE, TAG_ICON_NEXT, TAG_ICON_SEEKB, TAG_ICON_SEEKF, TAG_ICON_CONSUME}); + auto mod_format = m_formatter->get(format); + mod_format->fg = m_conf.get(name(), FORMAT_ONLINE + "-foreground"s, mod_format->fg); mod_format->bg = m_conf.get(name(), FORMAT_ONLINE + "-background"s, mod_format->bg); mod_format->ul = m_conf.get(name(), FORMAT_ONLINE + "-underline"s, mod_format->ul); @@ -38,6 +40,17 @@ namespace modules { mod_format->margin = m_conf.get(name(), FORMAT_ONLINE + "-margin"s, mod_format->margin); mod_format->offset = m_conf.get(name(), FORMAT_ONLINE + "-offset"s, mod_format->offset); + try { + mod_format->prefix = load_label(m_conf, name(), FORMAT_ONLINE + "-prefix"s); + } catch (const key_error& err) { + // format-online-prefix not defined + } + + try { + mod_format->suffix = load_label(m_conf, name(), FORMAT_ONLINE + "-suffix"s); + } catch (const key_error& err) { + // format-online-suffix not defined + } } m_formatter->add(FORMAT_OFFLINE, "", {TAG_LABEL_OFFLINE});