From 0079f5021efc2edd247d84a4a47bf59a7aba22ba Mon Sep 17 00:00:00 2001 From: kvj Date: Mon, 11 Dec 2023 19:24:14 +0100 Subject: [PATCH] Major update --- dwm-bar | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/dwm-bar b/dwm-bar index 9bedce6..377cae2 100755 --- a/dwm-bar +++ b/dwm-bar @@ -11,6 +11,28 @@ pkg_updates() { fi } +music() { + ARTIST=$(playerctl metadata artist) + TRACK=$(playerctl metadata title) + #DURATION=$(playerctl metadata mpris:length | sed 's/.\{6\}$//') + STATUS=$(playerctl status) + + if [ "$STATUS" = "Playing" ]; then + STATUS="" + else + STATUS=" 󰏤" + fi + + if [ "$ARTIST" = "" ]; then + printf "" + else + printf "^c#656565^  " + printf "$STATUS " + printf "^c#d4d5d5^$ARTIST - $TRACK" + fi + +} + weather() { weather=$(curl -s wttr.in/Reda?format=1 | grep -o ".[0-9].*") printf "^c#656565^  " @@ -44,6 +66,6 @@ while true; do [ $interval == 0 ] || [ $(($interval % 3600)) == 0 ] && updates=$(pkg_updates) interval=$((interval + 1)) - sleep 1 && xsetroot -name "$(update_icon) $updates $(weather) $(cpu) $(mem) $(clock)" + sleep 1 && xsetroot -name "$(music) $(update_icon) $updates $(weather) $(cpu) $(mem) $(clock)" done