fix(polybar): fix mullvad/music modules
This commit is contained in:
parent
cce4628211
commit
dde9c3f828
2 changed files with 24 additions and 1 deletions
23
dot_local/bin/executable_media-status
Normal file
23
dot_local/bin/executable_media-status
Normal 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)
|
|
@ -9,7 +9,7 @@ fi
|
||||||
while read -r LINE; do
|
while read -r LINE; do
|
||||||
if echo "$LINE" | grep -q 'Connected'; then
|
if echo "$LINE" | grep -q 'Connected'; then
|
||||||
# regex grep the relay, e.g. se7 for sweden-7
|
# 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=" "
|
ICON=" "
|
||||||
else
|
else
|
||||||
ICON=" "
|
ICON=" "
|
||||||
|
|
Loading…
Reference in a new issue