#!/bin/bash
truncs=13
trunca=10
song=$(playerctl metadata --format '{{ title }}')
artist=$(playerctl metadata --format '{{ artist }}')
#echo ${sample}

if [ ${#song} -gt $truncs ]; then
	songt=$(echo $song | head -c $truncs | sed 's/$/…/')
else
	if [ ${#song} -ne 0 ]; then
		songt=$(echo ${song})
	else
		songt=$(echo None)
	fi
fi

if [ ${#artist} -gt $trunca ]; then
	artistt=$(echo $artist | head -c $trunca | sed 's/$/…/')
else
	if [ ${#artist} -ne 0 ]; then
		artistt=$(echo ${artist})
	else
		artistt=$(echo None)
	fi
fi
echo "${songt}|${artistt}"


#hyprctl activewindow | grep title: | awk -F: '{print $2}' | head -c $trunc | sed 's/$/.../'

