You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
326 B
16 lines
326 B
#!/bin/bash
|
|
set -eu
|
|
|
|
artist=$(playerctl metadata artist)
|
|
title=$(playerctl metadata title)
|
|
|
|
if [ -z "$artist" ] && [ -z "$title" ]; then
|
|
exit 0
|
|
else
|
|
# trim and ellipsize if longer than 30 characters
|
|
text="$artist - $title"
|
|
if [ ${#text} -gt 30 ]; then
|
|
text="${text:0:29}…"
|
|
fi
|
|
echo "$text"
|
|
fi
|