mpd: add uri and filename format arguments

This commit is contained in:
Stefan Haan
2024-12-28 13:58:19 +01:00
parent 5346649fc6
commit d100e78872
2 changed files with 10 additions and 3 deletions

View File

@ -118,7 +118,7 @@ void waybar::modules::MPD::setLabel() {
auto format = format_;
Glib::ustring artist, album_artist, album, title;
std::string date, filename;
std::string date, filename, uri;
int song_pos = 0, queue_length = 0, volume = 0;
std::chrono::seconds elapsedTime, totalTime;
@ -151,6 +151,7 @@ void waybar::modules::MPD::setLabel() {
title = sanitize_string(getTag(MPD_TAG_TITLE));
date = sanitize_string(getTag(MPD_TAG_DATE));
filename = sanitize_string(getFilename());
uri = mpd_song_get_uri(song_.get());
song_pos = mpd_status_get_song_pos(status_.get()) + 1;
volume = mpd_status_get_volume(status_.get());
if (volume < 0) {
@ -184,7 +185,8 @@ void waybar::modules::MPD::setLabel() {
fmt::arg("songPosition", song_pos), fmt::arg("queueLength", queue_length),
fmt::arg("stateIcon", stateIcon), fmt::arg("consumeIcon", consumeIcon),
fmt::arg("randomIcon", randomIcon), fmt::arg("repeatIcon", repeatIcon),
fmt::arg("singleIcon", singleIcon), fmt::arg("filename", filename));
fmt::arg("singleIcon", singleIcon), fmt::arg("filename", filename),
fmt::arg("uri", uri));
if (text.empty()) {
label_.hide();
} else {
@ -208,7 +210,8 @@ void waybar::modules::MPD::setLabel() {
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),
fmt::arg("repeatIcon", repeatIcon), fmt::arg("singleIcon", singleIcon));
fmt::arg("repeatIcon", repeatIcon), fmt::arg("singleIcon", singleIcon),
fmt::arg("filename", filename), fmt::arg("uri", uri));
label_.set_tooltip_text(tooltip_text);
} catch (fmt::format_error const& e) {
spdlog::warn("mpd: format error (tooltip): {}", e.what());