Added function playerCmus in the dwm_status

This commit is contained in:
Marcin Wozniak 2019-06-01 13:39:07 +02:00
parent 987237a689
commit 1268c256e4
2 changed files with 18 additions and 33 deletions

View File

@ -8,8 +8,8 @@ static const unsigned int systraypinning = 0; /* 0: sloppy systray follows sel
static const unsigned int systrayspacing = 2; /* systray spacing */ static const unsigned int systrayspacing = 2; /* systray spacing */
static const int systraypinningfailfirst = 1; /* 1: if pinning fails, display systray on the first monitor, False: display systray on the last monitor*/ static const int systraypinningfailfirst = 1; /* 1: if pinning fails, display systray on the first monitor, False: display systray on the last monitor*/
static const int showsystray = 1; /* 0 means no systray */ static const int showsystray = 1; /* 0 means no systray */
static const char *fonts[] = { "monospace:size=13", "Font Awesome 5 Free Solid:size=13"}; static const char *fonts[] = { "monospace:size=15", "Font Awesome 5 Free Solid:size=15"};
static const char dmenufont[] = "monospace:size=13"; static const char dmenufont[] = "monospace:size=15";
static const char col_gray1[] = "#222222"; static const char col_gray1[] = "#222222";
static const char col_gray2[] = "#444444"; static const char col_gray2[] = "#444444";
static const char col_gray3[] = "#bbbbbb"; static const char col_gray3[] = "#bbbbbb";

View File

@ -91,36 +91,21 @@ usageData() {
playerCmus(){ playerCmus(){
if info=$(cmus-remote -Q 2> /dev/null); then cmus=$(cmus-remote -Q | grep status)
status=$(echo "$info" | grep status | awk -F\ '{print $2}') case "$cmus" in
"status stop"*)
file=$(echo "$info" | grep file | awk -F\ '{print $2}') echo ""
;;
if [ "$status" = "playing" ] || [ "$status" = "paused" ]; then "status paused"*)
title=$(echo "$info" | grep title | awk -F\ '{$1=$2=""; print $0}' | sed 's|^[[:blank:]]*||g') echo "|  |"
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}') 'status playing'*)
duration=$(echo "$info" | grep duration | awk -F\ '{print $2}') echo "|  |"
;;
pos_minutes=$(printf "%02d" $(("$position" / 60))) "")
pos_seconds=$(printf "%02d" $(("$position" % 60))) echo ""
;;
dur_minutes=$(printf "%02d" $(("$duration" / 60))) esac
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 echo AUTOSTART
@ -144,7 +129,7 @@ getforecast&
while true while true
do 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 sleep 2
done done