20 lines
590 B
Bash
Executable File
20 lines
590 B
Bash
Executable File
#!/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
|
|
|
|
playerctl metadata title > /dev/null
|
|
|
|
if [ "$?" != 0 ]; then
|
|
printf "No players found"
|
|
elif [ ${CONCISE} == "false" ]; then
|
|
printf "%.${MAXCHAR}s\n" "${TRACK} - by ${ARTIST} - on ${ALBUM}"
|
|
elif [ ${CONCISE} == "true" ]; then
|
|
printf "%.${MAXCHAR}s\n" "${ARTIST} - ${TRACK}"
|
|
else
|
|
printf "error: 'CONCISE' must be defined in i3blocks config\n"
|
|
fi
|