feat(mpd): Format tags for back-/forward seek

This commit is contained in:
Michael Carlberg 2016-06-21 05:10:18 +02:00
parent 4366c36704
commit d8a3d7d5f6
3 changed files with 17 additions and 2 deletions

View File

@ -685,7 +685,9 @@ See [the bspwm module](#user-content-dependencies) for details on `label-dimmed`
; <icon-play>
; <icon-pause>
; <icon-next>
format-online = <icon-prev> <icon-stop> <toggle> <icon-next> <icon-repeat> <icon-random> <bar-progress> <label-time> <label-song>
; <icon-seekb>
; <icon-seekf>
format-online = <icon-prev> <icon-seekb> <icon-stop> <toggle> <icon-seekf> <icon-next> <icon-repeat> <icon-random> <bar-progress> <label-time> <label-song>
; Available tags:
; <label-offline>
@ -713,6 +715,8 @@ See [the bspwm module](#user-content-dependencies) for details on `label-dimmed`
icon-stop = ⏹
icon-prev = ⏮
icon-next = ⏭
icon-seekb = ⏪
icon-seekf = ⏩
icon-random = 🔀
icon-repeat = 🔁
;icon-repeatone = 🔂

View File

@ -30,6 +30,8 @@ namespace modules
static constexpr auto TAG_ICON_PLAY = "<icon-play>";
static constexpr auto TAG_ICON_PAUSE = "<icon-pause>";
static constexpr auto TAG_ICON_NEXT = "<icon-next>";
static constexpr auto TAG_ICON_SEEKB = "<icon-seekb>";
static constexpr auto TAG_ICON_SEEKF = "<icon-seekf>";
static constexpr auto FORMAT_OFFLINE = "format-offline";
static constexpr auto TAG_LABEL_OFFLINE = "<label-offline>";

View File

@ -23,7 +23,8 @@ MpdModule::MpdModule(std::string name_)
this->formatter->add(FORMAT_ONLINE, TAG_LABEL_SONG, {
TAG_BAR_PROGRESS, TAG_TOGGLE, TAG_LABEL_SONG, TAG_LABEL_TIME,
TAG_ICON_RANDOM, TAG_ICON_REPEAT, TAG_ICON_REPEAT_ONE, TAG_ICON_PREV,
TAG_ICON_STOP, TAG_ICON_PLAY, TAG_ICON_PAUSE, TAG_ICON_NEXT });
TAG_ICON_STOP, TAG_ICON_PLAY, TAG_ICON_PAUSE, TAG_ICON_NEXT,
TAG_ICON_SEEKB, TAG_ICON_SEEKF });
this->formatter->add(FORMAT_OFFLINE, "", { TAG_LABEL_OFFLINE });
if (this->formatter->has(TAG_ICON_PLAY) || this->formatter->has(TAG_TOGGLE))
@ -36,6 +37,10 @@ MpdModule::MpdModule(std::string name_)
this->icons->add("prev", drawtypes::get_config_icon(name(), get_tag_name(TAG_ICON_PREV)));
if (this->formatter->has(TAG_ICON_NEXT))
this->icons->add("next", drawtypes::get_config_icon(name(), get_tag_name(TAG_ICON_NEXT)));
if (this->formatter->has(TAG_ICON_SEEKB))
this->icons->add("seekb", drawtypes::get_config_icon(name(), get_tag_name(TAG_ICON_SEEKB)));
if (this->formatter->has(TAG_ICON_SEEKF))
this->icons->add("seekf", drawtypes::get_config_icon(name(), get_tag_name(TAG_ICON_SEEKF)));
if (this->formatter->has(TAG_ICON_RANDOM))
this->icons->add("random", drawtypes::get_config_icon(name(), get_tag_name(TAG_ICON_RANDOM)));
if (this->formatter->has(TAG_ICON_REPEAT))
@ -258,6 +263,10 @@ bool MpdModule::build(Builder *builder, std::string tag)
icon_cmd(builder, EVENT_PLAY, this->icons->get("play"));
else if (tag == TAG_ICON_NEXT)
icon_cmd(builder, EVENT_NEXT, this->icons->get("next"));
else if (tag == TAG_ICON_SEEKB)
icon_cmd(builder, std::string(EVENT_SEEK).append("-5"), this->icons->get("seekb"));
else if (tag == TAG_ICON_SEEKF)
icon_cmd(builder, std::string(EVENT_SEEK).append("+5"), this->icons->get("seekf"));
else
return false;