aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go9
1 files changed, 4 insertions, 5 deletions
diff --git a/main.go b/main.go
index d765d9f..eacd904 100644
--- a/main.go
+++ b/main.go
@@ -97,11 +97,10 @@ func playerJSON(p *mpris2.Player) string {
text += v + right
}
out += "\",\"text\":\"" + text + "\","
- out += "\"tooltip\":\"" + fmt.Sprintf(
- "%s\\nby %s\\n",
- strings.ReplaceAll(p.Title, "&", "&"),
- strings.ReplaceAll(p.Artist, "&", "&"),
- )
+ out += "\"tooltip\":\"" + strings.ReplaceAll(p.Title, "&", "&") + "\\n"
+ if p.Artist != "" {
+ out += "by " + strings.ReplaceAll(p.Artist, "&", "&") + "\\n"
+ }
if p.Album != "" {
out += "from " + strings.ReplaceAll(p.Album, "&", "&") + "\\n"
}