# This script is generated by FTWA
# /u/ links are only available for 24h
# Check the app store to find more apps: https://ftwa.mathix.dev/store

# Exit on error
set -e;

# Setup Firefox if needed
# Firefox setup skipped

echo "
Creating desktop entry...";
tmpdir="$(mktemp -d)";
tmp_desktop_file="$tmpdir/ftwa-youtube-music.desktop";

cat > $tmp_desktop_file <<EOF
[Desktop Entry]
Type=Application
Name=YouTube Music
Exec=/usr/bin/google-chrome-stable --app='https://music.youtube.com'
Icon=ftwa-youtube-music
Terminal=false
StartupNotify=true
StartupWMClass=ftwa-youtube-music

# This file was generated using FTWA (https://ftwa.mathix.dev)
EOF

icon_path="$tmpdir/ftwa-youtube-music.png";
curl -fsSLo $icon_path 'https://cdn.icon-icons.com/icons2/3132/PNG/512/youtube_music_social_network_song_multimedia_icon_192250.png';

xdg-desktop-menu install $tmp_desktop_file;
xdg-icon-resource install --size 512 "${tmpdir}/ftwa-youtube-music.png" 'ftwa-youtube-music';

echo "Desktop entry created.";