From e9f999268270349b191e1b5c1a12ff6ef31619db Mon Sep 17 00:00:00 2001 From: Aaron Bieber Date: Tue, 9 Feb 2021 07:44:27 -0700 Subject: [PATCH] add now playing to bar --- bin/bar | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/bin/bar b/bin/bar index 870d494..563512e 100755 --- a/bin/bar +++ b/bin/bar @@ -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)"