fix(polybar): fix mullvad/music modules

This commit is contained in:
winston 2022-08-04 05:31:12 +02:00
parent cce4628211
commit dde9c3f828
Signed by: winston
GPG key ID: 3786770EDBC2B481
2 changed files with 24 additions and 1 deletions

View file

@ -0,0 +1,23 @@
#!/usr/bin/env bash
if ! [[ -x "$(command -v playerctl)" ]]; then
echo "install playerctl"
exit 1
fi
while read -r LINE; do
if [[ $LINE == "No players found" ]]; then
ICON=""
OUTPUT=""
else
STATE=$(echo "$LINE" | cut -d " " -f1)
OUTPUT=$(echo "$LINE" | cut -d " " -f2-)
if [[ $STATE == "Paused" ]]; then
ICON=""
else
ICON=""
fi
fi
echo "$ICON" "${OUTPUT}"
done < <(playerctl metadata -f '{{status}} {{artist}} - {{title}}' -F)

View file

@ -9,7 +9,7 @@ fi
while read -r LINE; do
if echo "$LINE" | grep -q 'Connected'; then
# regex grep the relay, e.g. se7 for sweden-7
OUTPUT=$(echo "$LINE" | grep -oE "\w{2}\d+")
OUTPUT=$(echo "$LINE" | grep -oP "\w{2}\d+")
ICON=" "
else
ICON=" "