Added function playerCmus in the dwm_status
This commit is contained in:
47
dwm_status
47
dwm_status
@ -91,36 +91,21 @@ usageData() {
|
||||
|
||||
|
||||
playerCmus(){
|
||||
if info=$(cmus-remote -Q 2> /dev/null); then
|
||||
status=$(echo "$info" | grep status | awk -F\ '{print $2}')
|
||||
|
||||
file=$(echo "$info" | grep file | awk -F\ '{print $2}')
|
||||
|
||||
if [ "$status" = "playing" ] || [ "$status" = "paused" ]; then
|
||||
title=$(echo "$info" | grep title | awk -F\ '{$1=$2=""; print $0}' | sed 's|^[[:blank:]]*||g')
|
||||
artist=$(echo "$info" | grep '[[:space:]]artist' | awk -F\ '{$1=$2=""; print $0}' | sed 's|^[[:blank:]]*||g')
|
||||
position=$(echo "$info" | grep position | awk -F\ '{print $2}')
|
||||
duration=$(echo "$info" | grep duration | awk -F\ '{print $2}')
|
||||
|
||||
pos_minutes=$(printf "%02d" $(("$position" / 60)))
|
||||
pos_seconds=$(printf "%02d" $(("$position" % 60)))
|
||||
|
||||
dur_minutes=$(printf "%02d" $(("$duration" / 60)))
|
||||
dur_seconds=$(printf "%02d" $(("$duration" % 60)))
|
||||
|
||||
stream=$(cmus-remote -Q | grep stream | sed -e 's/stream\>//g')
|
||||
tag=$(cmus-remote -Q | grep "tag title" | sed -e 's/tag title\>//g')
|
||||
echo ""
|
||||
#echo " $pos_minutes:$pos_seconds / $dur_minutes:$dur_seconds"
|
||||
elif [ "$status" = "paused" ]; then
|
||||
echo ""
|
||||
#echo " $pos_minutes:$pos_seconds / $dur_minutes:$dur_seconds"
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
cmus=$(cmus-remote -Q | grep status)
|
||||
case "$cmus" in
|
||||
"status stop"*)
|
||||
echo ""
|
||||
;;
|
||||
"status paused"*)
|
||||
echo "| |"
|
||||
;;
|
||||
'status playing'*)
|
||||
echo "| |"
|
||||
;;
|
||||
"")
|
||||
echo ""
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
echo AUTOSTART
|
||||
@ -144,7 +129,7 @@ getforecast&
|
||||
|
||||
while true
|
||||
do
|
||||
xsetroot -name " $(playerCmus) | $(print_temp) | $(usageData) | $(testweather) | $(print_wifi) | $(batLevel) | $(print_volume) | $(print_date)"
|
||||
xsetroot -name "$(playerCmus) $(print_temp) | $(usageData) | $(testweather) | $(print_wifi) | $(batLevel) | $(print_volume) | $(print_date)"
|
||||
sleep 2
|
||||
|
||||
done
|
||||
|
Reference in New Issue
Block a user