Added function playerCmus in the dwm_status
This commit is contained in:
parent
987237a689
commit
1268c256e4
4
config.h
4
config.h
@ -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 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 char *fonts[] = { "monospace:size=13", "Font Awesome 5 Free Solid:size=13"};
|
||||
static const char dmenufont[] = "monospace:size=13";
|
||||
static const char *fonts[] = { "monospace:size=15", "Font Awesome 5 Free Solid:size=15"};
|
||||
static const char dmenufont[] = "monospace:size=15";
|
||||
static const char col_gray1[] = "#222222";
|
||||
static const char col_gray2[] = "#444444";
|
||||
static const char col_gray3[] = "#bbbbbb";
|
||||
|
43
dwm_status
43
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
|
||||
cmus=$(cmus-remote -Q | grep status)
|
||||
case "$cmus" in
|
||||
"status stop"*)
|
||||
echo ""
|
||||
fi
|
||||
else
|
||||
;;
|
||||
"status paused"*)
|
||||
echo "| |"
|
||||
;;
|
||||
'status playing'*)
|
||||
echo "| |"
|
||||
;;
|
||||
"")
|
||||
echo ""
|
||||
fi
|
||||
;;
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user