39 lines
833 B
Bash
Executable file
39 lines
833 B
Bash
Executable file
#!/bin/bash
|
|
|
|
case $BLOCK_BUTTON in
|
|
1) mocp -r ;;
|
|
2) mocp -G ;;
|
|
3) mocp -f ;;
|
|
4) mocp -j $(($(mocp -Q "%cs") - 5))s ;;
|
|
5) mocp -j $(($(mocp -Q "%cs") + 5))s ;;
|
|
esac
|
|
|
|
status=$(mocp -Q "%state")
|
|
case $status in
|
|
STOP ) status="<span foreground=\"#F2777A\">⏹</span>" ;;
|
|
PAUSE ) status="<span foreground=\"#FFCC66\">⏸</span>" ;;
|
|
PLAY ) status="<span foreground=\"#99CC99\">⏵</span>" ;;
|
|
esac
|
|
|
|
dots=
|
|
song=$(mocp -Q "%song")
|
|
|
|
[[ -z "$song" ]] && song=$(basename "$(mocp -Q %file)")
|
|
|
|
if [ ${#song} -gt 30 ]
|
|
then
|
|
dots="…"
|
|
fi
|
|
if [ ${#song} -gt 15 ]
|
|
then
|
|
shortdots="…"
|
|
fi
|
|
|
|
time="$(mocp -Q "[%ct %tl %tt]")"
|
|
shorttime="$(mocp -Q "%ct %tl")"
|
|
|
|
[[ -z "$time" ]] && time="[00:00 00:00 00:00]"
|
|
[[ -z "$shorttime" ]] && shorttime="00:00 00:00"
|
|
|
|
echo "$status ${song:0:30}$dots $time"
|
|
echo "$status ${song:0:15}$shortdots $shorttime"
|