Added function playerCmus in the dwm_status
This commit is contained in:
38
dwm_status
38
dwm_status
@ -35,7 +35,7 @@ print_temp(){
|
||||
}
|
||||
|
||||
print_date(){
|
||||
echo -e " $(date +"%m-%e %H:%M")"
|
||||
echo -e " $(date +"%m-%d %H:%M")"
|
||||
}
|
||||
|
||||
print_mail(){
|
||||
@ -89,6 +89,40 @@ usageData() {
|
||||
echo -e " $cpuUse% $ramUseB%"
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
echo AUTOSTART
|
||||
feh --bg-fill $HOME/.wall.jpg &
|
||||
xset s off -dpms&
|
||||
@ -110,7 +144,7 @@ getforecast&
|
||||
|
||||
while true
|
||||
do
|
||||
xsetroot -name " $(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