i3blocks-mediaplayer/mediaplayer
2023-12-04 07:57:19 -05:00

16 lines
499 B
Bash

#!/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="75" # Maximum characters allowed in string
if [ ${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