mirror of
https://github.com/elkowar/dots-of-war.git
synced 2024-11-06 11:22:23 +00:00
38 lines
1 KiB
Bash
Executable file
38 lines
1 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
fixArtUrl() {
|
|
sed -e 's/open.spotify.com/i.scdn.co/g'
|
|
}
|
|
|
|
getData() {
|
|
eww update song-name "$(playerctl metadata --format "{{ xesam:title }}")"
|
|
wget -O /tmp/music-file "$(playerctl metadata --format "{{ mpris:artUrl }}"| fixArtUrl)"
|
|
eww update song-image /tmp/music-file
|
|
if [ -f /tmp/music-file ]; then
|
|
eww update song-image-visible true
|
|
else
|
|
eww update song-image-visible false
|
|
fi
|
|
|
|
eww update song-album "$(playerctl metadata --format "{{ xesam:album }}")"
|
|
eww update song-artist "$(playerctl metadata --format "{{ xesam:artist }}")"
|
|
if [ "spotify" = "$(playerctl metadata | head -n1 | awk '{ print $1 }')" ]; then
|
|
eww update song-show-progress "false"
|
|
else
|
|
eww update song-show-progress "true"
|
|
fi;
|
|
|
|
song_status="$(playerctl status --format "{{ lc(status) }}")"
|
|
if [ "$song_status" = "playing" ]; then
|
|
eww update song-playpause
|
|
else
|
|
eww update song-playpause
|
|
fi
|
|
|
|
|
|
}
|
|
|
|
getData
|
|
cat <(playerctl metadata --format '{{ title }}' -F & playerctl status -F) 2>&1 /dev/null
|