mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
Added song position and queue length.
This commit is contained in:
parent
459df4e0c9
commit
c651670222
@ -148,6 +148,10 @@ Addressed by *mpd*
|
||||
|
||||
*{totalTime}*: The length of the current song. To format as a date/time (see example configuration)
|
||||
|
||||
*{songPosition}*: The position of the current song.
|
||||
|
||||
*{queueLength}*: The length of the current queue.
|
||||
|
||||
*{stateIcon}*: The icon corresponding the playing or paused status of the player (see *state-icons* option)
|
||||
|
||||
*{consumeIcon}*: The icon corresponding the "consume" option (see *consume-icons* option)
|
||||
|
@ -27,7 +27,7 @@
|
||||
"format": "<span style=\"italic\">{}</span>"
|
||||
},
|
||||
"mpd": {
|
||||
"format": "{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon}{artist} - {album} - {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S}) ",
|
||||
"format": "{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon}{artist} - {album} - {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S}) ⸨{songPosition}|{queueLength}⸩ ",
|
||||
"format-disconnected": "Disconnected ",
|
||||
"format-stopped": "{consumeIcon}{randomIcon}{repeatIcon}{singleIcon}Stopped ",
|
||||
"unknown-tag": "N/A",
|
||||
|
@ -133,6 +133,7 @@ void waybar::modules::MPD::setLabel() {
|
||||
auto format = format_;
|
||||
|
||||
std::string artist, album_artist, album, title, date;
|
||||
int song_pos, queue_length;
|
||||
std::chrono::seconds elapsedTime, totalTime;
|
||||
|
||||
std::string stateIcon = "";
|
||||
@ -161,6 +162,8 @@ void waybar::modules::MPD::setLabel() {
|
||||
album = getTag(MPD_TAG_ALBUM);
|
||||
title = getTag(MPD_TAG_TITLE);
|
||||
date = getTag(MPD_TAG_DATE);
|
||||
song_pos = mpd_status_get_song_pos(status_.get());
|
||||
queue_length = mpd_status_get_queue_length(status_.get());
|
||||
elapsedTime = std::chrono::seconds(mpd_status_get_elapsed_time(status_.get()));
|
||||
totalTime = std::chrono::seconds(mpd_status_get_total_time(status_.get()));
|
||||
}
|
||||
@ -184,6 +187,8 @@ void waybar::modules::MPD::setLabel() {
|
||||
fmt::arg("date", Glib::Markup::escape_text(date).raw()),
|
||||
fmt::arg("elapsedTime", elapsedTime),
|
||||
fmt::arg("totalTime", totalTime),
|
||||
fmt::arg("songPosition", song_pos),
|
||||
fmt::arg("queueLength", queue_length),
|
||||
fmt::arg("stateIcon", stateIcon),
|
||||
fmt::arg("consumeIcon", consumeIcon),
|
||||
fmt::arg("randomIcon", randomIcon),
|
||||
@ -200,6 +205,8 @@ void waybar::modules::MPD::setLabel() {
|
||||
fmt::arg("album", album),
|
||||
fmt::arg("title", title),
|
||||
fmt::arg("date", date),
|
||||
fmt::arg("songPosition", song_pos),
|
||||
fmt::arg("queueLength", queue_length),
|
||||
fmt::arg("stateIcon", stateIcon),
|
||||
fmt::arg("consumeIcon", consumeIcon),
|
||||
fmt::arg("randomIcon", randomIcon),
|
||||
|
Loading…
Reference in New Issue
Block a user