add now playing to bar

This commit is contained in:
Aaron Bieber 2021-02-09 07:44:27 -07:00
parent ae32741c96
commit e9f9992682

22
bin/bar
View File

@ -104,6 +104,24 @@ temp() {
printf "%2d°C" "${TMP}"
fi
}
now_playing() {
local NP
NP="-"
# MPD
if pgrep -q mpd; then
NP="$(mpc -f '%name% - %title%' | head -n1)"
fi
# Pianobar
if pgrep -q pianobar; then
NP="pianobar"
fi
printf "%s" "${NP}"
}
battery() {
local BATT BAR BATT_LINE
if sysctl -n hw.product | grep -iq pine64; then
@ -171,6 +189,6 @@ vmm() {
fi
}
printf "%%{l} %s | %s | %%{A:apm -A:}%%{A2:apm -L:}%%{A3:apm -H:}%s%%{A}%%{A}%%{A} | %s %%{r} %s | %s | %s | %s | @%s " \
printf "%%{l} %s | %s | %%{A:apm -A:}%%{A2:apm -L:}%%{A3:apm -H:}%s%%{A}%%{A}%%{A} | %s %%{r} | %s | %s | %s | %s | %s | @%s " \
"$(battery)" "$(temp)" "$(hz)" "$(mem)" \
"$(vmm)" "$(mail)" "$(wifi)" "$(date '+%Y-%m-%d %H:%M')" "$(beat)"
"$(now_playing)" "$(vmm)" "$(mail)" "$(wifi)" "$(date '+%Y-%m-%d %H:%M')" "$(beat)"