Added function playerCmus in the dwm_status

This commit is contained in:
Marcin Wozniak 2019-06-01 12:41:06 +02:00
parent 8be6ac4a46
commit 987237a689
4 changed files with 45 additions and 101 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 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=15", "Font Awesome 5 Free Solid:size=15"};
static const char dmenufont[] = "monospace:size=14";
static const char *fonts[] = { "monospace:size=13", "Font Awesome 5 Free Solid:size=13"};
static const char dmenufont[] = "monospace:size=13";
static const char col_gray1[] = "#222222";
static const char col_gray2[] = "#444444";
static const char col_gray3[] = "#bbbbbb";
@ -105,10 +105,11 @@ static Key keys[] = {
{ MODKEY, XK_Return, zoom, {0} },
{ MODKEY, XK_Tab, view, {0} },
{ MODKEY|ShiftMask, XK_q, killclient, {0} },
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
{ MODKEY, XK_space, setlayout, {0} },
/*{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },*/
/*{ MODKEY|ShiftMask, XK_f, setlayout, {.v = &layouts[1]} },*/
{ MODKEY, XK_f, setlayout, {.v = &layouts[2]} },
/*{ MODKEY, XK_space, setlayout, {0} },*/
{ MODKEY, XK_space, setlayout, {.v = &layouts[0]} },
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
{ MODKEY, XK_0, view, {.ui = ~0 } },
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },

View File

@ -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

View File

@ -1,93 +0,0 @@
# #!/bin/sh
# 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')
# radioTurn=0
# if [ "$file" = "http://sky1.torontocast.com:9041/.mp3" ]; then
# echo "  $stream"
# radioTurn=1
# fi
# if [ "$tag" = " Radio ZET" ]; then
# echo "  Radio ZET"
# radioTurn=1
# fi
# if [ "$radioTurn" = "0" ]; then
# #echo "  $pos_minutes:$pos_seconds / $dur_minutes:$dur_seconds"
# echo "  $pos_minutes:$pos_seconds / $dur_minutes:$dur_seconds"
# #echo " $artist - $title | $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
# else
# echo ""
# fi
#!/bin/sh
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')
radioTurn=0
if [ "$radioTurn" = "0" ]; then
#echo "  $pos_minutes:$pos_seconds / $dur_minutes:$dur_seconds"
echo "$pos_minutes:$pos_seconds / $dur_minutes:$dur_seconds"
#echo " $artist - $title | $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
else
echo ""
fi

View File

@ -29,6 +29,8 @@ bind e new-window -n '~/.tmux.conf.local' "sh -c '\${EDITOR:-vim} ~/.tmux.conf.l
# reload configuration
bind r source-file ~/.tmux.conf \; display '~/.tmux.conf sourced'
# kill current window
bind q killp
# -- display -------------------------------------------------------------------