Improved algorithm aimed to be used with polybar

This commit is contained in:
Ferit Yiğit BALABAN 2022-07-16 01:41:13 +03:00
parent 3fb64b18b0
commit 14d27eb3be

View File

@ -1,8 +1,17 @@
#!/bin/bash #!/bin/bash
s=$( playerctl -f '{{trunc(xesam:artist, 20)}} - {{trunc(xesam:title, 30)}}' metadata ) stat=$( playerctl status )
if [ $? -eq 0 ]; then msg=$( playerctl -f '{{trunc(xesam:artist, 15)}} - {{trunc(xesam:title, 30)}}' metadata )
echo "$s" if [ "$stat" = "Playing" ]; then
if [ "$msg" = " - " ]; then
echo "No metadata"
else
echo "$msg"
fi
else else
if [ "$stat" = "Paused" ]; then
echo "Paused"
else
echo "" echo ""
fi
fi fi
exit 0 exit 0