config/fish/functions/musicfetch.fish

27 lines
894 B
Fish
Raw Permalink Normal View History

function musicfetch
# Clear the terminal for that fresh widget look
clear
# Get metadata using playerctl
set -l title (playerctl metadata title)
set -l artist (playerctl metadata artist)
set -l album (playerctl metadata album)
set -l art_url (playerctl metadata mpris:artUrl)
# Download the cover art to a temp file if it exists
if test -n "$art_url"
curl -s "$art_url" -o /tmp/cover.png
# Display the image using chafa (tuned for a small widget size)
chafa --size=20x10 /tmp/cover.png
else
echo "No Art Found"
end
# Print the info in a style matching your fastfetch setup
# Adwaita Blue (#3584e4) and Adwaita Green (#33d17a)
echo -e "\e[34mTitle \e[0m: $title"
echo -e "\e[34mArtist \e[0m: $artist"
echo -e "\e[32mAlbum \e[0m: $album"
echo -e "\e[35mStatus \e[0m: "(playerctl status)
end