added music info to waybar

This commit is contained in:
Ryan Schanzenbacher 2023-09-07 23:50:02 -04:00
parent e8351e69e9
commit f9f087f055
Signed by: ryan77627
GPG key ID: 81B0E222A3E2308E
3 changed files with 13 additions and 6 deletions

View file

@ -75,9 +75,9 @@
"interval": 2,
"return-type": "json",
"exec": "~/.config/waybar/modules/spotify.sh",
"exec-if": "pgrep spotifyd",
"exec-if": "~/.config/waybar/modules/check-for-music.sh",
"escape": true,
"on-click": "~/.config/waybar/modules/spotify-play-pause.sh play-pause"
"on-click": "playerctl play-pause"
},
"custom/storage": {
"format-alt": "{} ",

View file

@ -0,0 +1,7 @@
#!/bin/sh
if [[ $(playerctl metadata --format '{{lc(status)}}' | grep playing) -eq 0 ]]; then
exit 0
else
exit 1
fi

View file

@ -1,12 +1,12 @@
#!/bin/sh
class=$(playerctl metadata --player=spotifyd --format '{{lc(status)}}')
icon=""
class=$(playerctl metadata --format '{{lc(status)}}')
icon="󰽴"
if [[ $class == "playing" ]]; then
info=$(playerctl metadata --player=spotifyd --format '{{artist}} - {{title}}')
info=$(playerctl metadata --format '{{artist}} - {{title}}')
if [[ ${#info} > 40 ]]; then
info=$(echo $info | cut -c1-40)"..."
info=$(playerctl metadata --format '{{title}}' | cut -c1-40)"..."
fi
text=$info" "$icon
elif [[ $class == "paused" ]]; then