1
0
Fork 0
dotfiles/.config/eww/scripts/player
2022-03-20 03:19:38 -04:00

17 lines
431 B
Bash
Executable file

#!/usr/bin/env bash
echo "{\"show\": \"no\", \"content\": \"\"}"
while true
do
line=$(spt playback --status -f "%s:%a - %t" 2> /dev/null)
IFS=':' read -ra ELS <<< "$line"
button=${ELS[0]}
content=${ELS[1]}
if [ "$button" == "▶" ]; then
echo "{\"show\": \"yes\", \"content\": \"(label :text \\\"$content\\\")\"}"
else
echo "{\"show\": \"no\", \"content\": \"\"}"
fi
sleep 1
done