Files
dotfiles/waybar/scripts/spotify.sh
T
2024-04-27 19:49:08 +07:00

17 lines
607 B
Bash
Executable File

#!/bin/bash
while true
do
player_status=$(playerctl -p spotify status 2> /dev/null)
if [ "$player_status" = "Playing" ]; then
artist=$(playerctl -p spotify metadata artist)
title=$(playerctl -p spotify metadata title)
echo '{"text": "'"$artist - $title"'", "class": "custom-spotify", "alt": "Spotify"}'
elif [ "$player_status" = "Paused" ]; then
artist=$(playerctl -p spotify metadata artist)
title=$(playerctl -p spotify metadata title)
echo '{"text": "'"Paused"'", "class": "custom-spotify", "alt": "Spotify (Paused)"}'
fi
sleep 1
done