diff options
| author | JackJ30 <jackqjamison@proton.me> | 2024-09-07 14:02:06 -0400 |
|---|---|---|
| committer | JackJ30 <jackqjamison@proton.me> | 2024-09-07 14:02:06 -0400 |
| commit | ee71cba8d51ea5635ebda2ba0c776e8378706c6d (patch) | |
| tree | eff818f88b2702724eea111eca4a55512543e971 /.config/waybar/modules/spotify.sh | |
| parent | e70986a9c299f004aa290bde0ec430ca864f7e74 (diff) | |
better stow
Diffstat (limited to '.config/waybar/modules/spotify.sh')
| -rwxr-xr-x | .config/waybar/modules/spotify.sh | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/.config/waybar/modules/spotify.sh b/.config/waybar/modules/spotify.sh new file mode 100755 index 0000000..1d13620 --- /dev/null +++ b/.config/waybar/modules/spotify.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +class=$(playerctl metadata --player=spotify --format '{{lc(status)}}') +icon="" + +if [[ $class == "playing" ]]; then + info=$(playerctl metadata --player=spotify --format '{{artist}} - {{title}}') + if [[ ${#info} > 40 ]]; then + info=$(echo $info | cut -c1-40)"..." + fi + text=$info" "$icon +elif [[ $class == "paused" ]]; then + text=$icon +elif [[ $class == "stopped" ]]; then + text="" +fi + +echo -e "{\"text\":\""$text"\", \"class\":\""$class"\"}" + |
