config-fish/functions/music.fish

30 lines
609 B
Fish

function music
argparse h/help c/client -- $argv
or return
if set -ql _flag_help
echo "music [-h|--help] [-c/--client]"
return 0
end
if set -ql _flag_client
ncmpcpp
end
set -f path (mpc -f %file% | sed -E '1 s:^(.+)\\/([^\\/]+)$:\1:' | head -n 1 | tr -d "\n")
set cover (fd -e png -e jpg . "$HOME/Music/$path/")
chafa --size=100x100 $cover
mpc -f "%artist%@%album%@%title%" | head -n 1 | read -d @ -l artist album song
echo ""
set_color red
echo -n $artist
set_color white
echo -n " - "
set_color cyan
echo -n $album
set_color white
echo -n " - "
set_color green
echo $song
end