# 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-spotify.desktop";

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

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

icon_path="$tmpdir/ftwa-spotify.png";
curl -fsSLo $icon_path 'https://www.freepnglogos.com/uploads/spotify-logo-png/spotify-icon-marilyn-scott-0.png';

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

echo "Desktop entry created.";