i3blocks-config/scripts/mediaplayer2

20 lines
592 B
Plaintext
Raw Normal View History

2024-02-08 18:36:37 -05:00
#!/bin/bash
TRACK=$(playerctl metadata title) # Command to get track
ARTIST=$(playerctl metadata artist) # Command to get artist
ALBUM=$(playerctl metadata album) # Command to get album
MAXCHAR="128" # Maximum characters allowed in string
2024-04-26 15:09:23 -04:00
playerctl metadata title > /dev/null
if [ "$?" != 0 ]; then
printf "No players found"
elif [ ${CONCISE} == "false" ]; then
2024-11-25 16:16:17 -05:00
printf "%.${MAXCHAR}s\n" "${TRACK} - by ${ARTIST} - from ${ALBUM}"
2024-02-08 18:36:37 -05:00
elif [ ${CONCISE} == "true" ]; then
2024-11-25 16:16:17 -05:00
printf "%.${MAXCHAR}s\n" "${TRACK} - ${ARTIST}"
2024-02-08 18:36:37 -05:00
else
printf "error: 'CONCISE' must be defined in i3blocks config\n"
fi